![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| scp automated script | gholdbhurg | UNIX for Advanced & Expert Users | 5 | 10-27-2008 01:23 AM |
| automated sftp script | klindel | Shell Programming and Scripting | 2 | 05-13-2008 01:45 AM |
| Need automated shell script please | uneex | Shell Programming and Scripting | 2 | 05-02-2008 08:36 AM |
| Need help for automated shell script | uneex | Shell Programming and Scripting | 4 | 05-01-2008 12:15 PM |
| help for automated script | splax | UNIX for Advanced & Expert Users | 4 | 12-26-2006 05:36 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
echo "Enter your choice :\c"
read num case $num in . 1)"${TEST_HOME}"/ctrl_extract.ksh 1 ;; 2)"${TEST_HOME}"/ctrl_extract.ksh 2 ;;3)"${TEST_HOME}"/ctrl_extract.ksh 3 ;; 4)"${TEST_HOME}"/ctrl_extract.ksh 4 ;; 5)"${TEST_HOME}"/ctrl_extract.ksh 5 ;; ......................................................... ............................................................. ............................................................... this is my script-i hv number of cases.so i dont want writing case just like above..i want a single line script between case block so that writing 100 cases is not required. |
|
||||
|
Please post your script with the code tags.
Use test if you don't want to write 100 case statements. Code:
echo "Enter your choice :\c"
read num
if [ $num -gt 0 -a $num -lt 101 ]; then "${TEST_HOME}"/ctrl_extract.ksh $num; fi
|
|
||||
|
Just a refinement in the above script
echo "Enter your choice :\c" read num #if [ $num -gt 0 -a $num -lt 101 ]; then ->Can remove this if not needed "${TEST_HOME}"/ctrl_extract.ksh $num; #fi Hope there is no restriction in the number that the user mentions. |
|
||||
|
Code:
if [ "$#" -gt 0 -a "$1" -gt 0 -a "$1" -lt 100 ]
then
"${TEST_HOME}"/ctrl_extract.ksh $1;
fi
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|