About the "rm -f" question, it depends on your needs! Generally, linux boxes have an alias that point rm to "rm -i" and if you want to bypass the alias, you can use "rm -f", so nothing will be asked when removing a file, otherwise, a message will be printed.
while true
do
clear
echo "Menu Options: "
echo " 1. Create Script"
echo " 2. Show Script"
echo " 3. Delete script"
echo " 4. Exit"
echo " Choose: "
read menuOpt
case "${menuOpt}" in
1) echo "Enter name"
break;;
Im having some trouble with this part, i get everything to show up but when it comes to "Choose" i press 1 and nothing happens. I also tried the read -p instead of a echo. Didnt work
And also can if statements be put into this loop to? Like after they enter a name i need them to choose a colour and if they enter or spel a color wrong they have to reenter it?
#!/bin/ksh
oldIFS=$IFS
IFS='
'
actions='Create Script
Show Script
Delete script
Exit'
PS3='Pick one of the above: '
select i in ${actions}
do
case $REPLY in
1) echo 'Enter name' ;;
2) cat script ;;
3) rm script ;;
4) exit 0 ;;
"") print -u2 you must select one of the above [${actions}] ;;
esac
REPLY=''
done
Please, be more specific with examples.
You can always use *NIX utils to validate input: file-based or otherwise.
Depending on what your specifics are, you may use grep, sed, awk, perl,etc...
if the value of the '$carsfile' variable point to the non-existing file, then it's what it is - the file you're trying to search doesn't exist.
You need to debug your script - include the 'set -x' at the top of your script and see the debug tracing.
In the above after pressing option 1, after everything is done in that part how would i get it to display all the options again so user can choose another option?