![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 11:16 AM |
| error during run: St9bad_alloc - Getting this error while using some conversion progr | sathu_pec | Shell Programming and Scripting | 1 | 01-21-2008 02:38 AM |
| I got error like...syntax error on line 1, teletype | koti_rama | UNIX for Advanced & Expert Users | 2 | 07-07-2007 07:35 PM |
| error reading sections error at install | doelman | SUN Solaris | 2 | 02-05-2007 12:21 PM |
| Error: Internal system error: Unable to initialize standard output file | firkus | UNIX for Dummies Questions & Answers | 2 | 10-25-2005 03:23 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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" read answer echo case "$answer" in a) read answer cat $answer ;; b) read answer echo cat> $answer ;; c) read answer echo cat>> $answer ;; d) break ;; *) continue ;; esac done echo "Done" |
|
||||
|
What is the meaning of in line 5
Code:
"; do You may use 'select' to do the same thing more convenience. PS3="Enter your choice > " select answer in "read a file" "create a file" "add on existing file" exit; do case "$answer" in 1) read answer cat $answer ;; 2) read answer echo cat> $answer ;; 3) read answer echo cat>> $answer ;; 4) exit ;; *) print 'Invalid input' ;; esac done |
|
||||
|
I suppose this is what you were intending to do
Regards JK echo " a.read a file" echo " b.create a file" echo " c.add on existing file" echo " d. exit" while [ true ] do echo "Enter a,b,c or d: \c" read answer echo case "$answer" in a) cat $answer ;; b) cat> $answer ;; c) cat>> $answer ;; d) exit break ;; *) echo "option should be a, b or c" ;; esac done |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|