![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is there any Javascript things for Lynx? | zeus | Security | 7 | 11-10-2007 05:56 PM |
| Question about several things in C | V4D3R | High Level Programming | 1 | 09-13-2007 07:56 PM |
| When things doesn't run into crontab??? | nymus7 | Shell Programming and Scripting | 4 | 04-24-2006 08:11 AM |
| Complicating things? | bconnor | High Level Programming | 1 | 03-30-2006 07:07 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
how to convert things from csh to sh
i have this method in csh that check for file exist.
#check that file exists if ( ! -e $6$5 ) then echo $6$5 Not Found exit 8 endif however i wanted in to be in just sh. so i change the code to: if [ ! -e $6$5 ]; then echo $6$5 Not Found exit 8 fi I get error showing test arguments needed or something like this..is there any problem with my coding? Btw the parameters are passed in...$5 is a text file and $6 is a path name. |
| Forum Sponsor | ||
|
|
|
|||
|
Put quote around the variable argument in the if staement. eg
if [ ! -e "$6$5" ] The reason you get an error in your own code when $5 and $6 are both empty is that the '-e' test requires an argument. By putting quotes round it you force an argument of a null string (rather than no argument at all) when $5 and $6 are both empty. Last edited by Unbeliever; 10-28-2005 at 07:06 AM. |
|||
| Google The UNIX and Linux Forums |