![]() |
|
|
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 |
| Expression syntax | morava | Shell Programming and Scripting | 1 | 03-20-2009 06:43 AM |
| sed error : Syntax error: redirection unexpected | phpfreak | Shell Programming and Scripting | 3 | 12-04-2008 05:19 AM |
| nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error | astjen | AIX | 9 | 10-03-2008 12:44 PM |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 11:16 AM |
| error: initializer expression list treated as compound expression | arunchaudhary19 | High Level Programming | 12 | 11-16-2007 06:44 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
One more expression syntax error
HI again, still working on the assignment, which is really hard given we just started unix 4 weeks ago. This script should change the permission for the user depending if its x, w or r, to the opposite. When i try to run it, I am getting expression error. Can you spot where the problem is? I really really appreciate it !!
Thanks so much !! #!/bin/csh # This script will accept a file name as one argument and the word # read, write or execute as the second argument # On top of that, it will switch the permissions to the opposite one if ($2==read) if (-r $1) then chmod +r $1 echo Permission changed to readable else chmod -r $1 echo Permission changed to not readable endif else if ($2==write) if (-w $1) then chmod +w $1 echo Permission changed to writeable else chmod -w $1 echo Permission changed to not writeable endif else if (-x $1) then chmod +x $1 echo Permission changed to executable else chmod -x $1 echo Permission changed to non executable endif |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|