Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cat command

Status
Not open for further replies.

props

Technical User
Nov 22, 2003
17
GB


Anyone can help ?
this is the error
g: echo Name the file that you want to add information:\c: not found
c)
echo" Name the file that you want to add information:\c"
read answer
echo
cat>> $answer
;;
 
Code:
echo " Name the file that you want to add information:\c"
    ^
add a space after the echo command


Hope This Help
PH.
 
works fine thanks

do you know how using a loop user to be able to exit

this is not the appropreate
d)
exit
;;
 
Some homeworks ?
Try something like this:
Code:
while echo "  Select option
  a) Option A
  b) Option B
  c) Add information
  d) Exit this menu
"; do
  read keypress
  case $keypress in
  a) echo "You have selected Option A "
     ;;
  b) echo "You have selected Option B "
     ;;
  c) echo "Name the file that you want to add information:\c"
     read answer
     echo
     cat >>$answer
     ;;
  d) break
     ;;
  *) echo "   WRONG SELECTION.  TRY AGAIN"
     continue
     ;;
  esac
done
echo "Done"
The exit instruction will terminate the script.
The break statement will exit the loop.
If your posted snippet is part of a function, a return instruction will exit the function.
If your shell is ksh you may consider the select instruction.

Hope This Help
PH.
 
There is an error which comes up

pro: syntax error at line 45: `end of file' unexpected
echo "\n COMMAND MENU\n"

while echo " Select option"
echo " a.read a file"
echo " b.create a file"
echo " c.add on existing file"
echo " d. exit"
"; do
echo "Enter a,b,c or d: \c"



...........
...........


echo " Wrong selection. Try again "
continue
;;
esac
done
echo "Done"

 
> "; do
Suppress the quote as you use multiple echo commands instead of just one as I posted.

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top