![]() |
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 |
| simple shell - how to get a parameter typed in a shell script | cmitulescu | Shell Programming and Scripting | 4 | 01-09-2009 08:45 PM |
| Linux Shell Question: how to print the shell script name ? | meili100 | UNIX for Dummies Questions & Answers | 3 | 07-01-2008 01:55 PM |
| Difference between writing Unix Shell script and AIX Shell Scripts | haroonec | AIX | 0 | 04-12-2006 02:27 AM |
| How to run unix commands in a new shell inside a shell script? | hkapil | Shell Programming and Scripting | 2 | 01-04-2006 06:56 AM |
| how to convert from korn shell to normal shell with this code? | forevercalz | Shell Programming and Scripting | 21 | 11-23-2005 02:18 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
how to do in sh shell
Hi,
I am attaching my shell script here then I will put my doubt: #!/bin/sh errorexit () { echo Error : $* echo } stval=`cut -d, -f1 ./dir.conf` for dir in $stval do echo " this is $dir" if [ ! -d "$dir" ] then errorexit "$dir" does not exist fi if [ ! -x "$dir" ] then errorexit "$dir" cannot be accessed fi if [ ! -r "$dir" ] then errorexit no read permission in $dir fi if [ ! -w "$dir" ] then errorexit no write permission in $dir fi done the dir.conf is a file which contains the name of directories. I got the directories name and stored it in dir variable. Now I test the different permissions by using if conditions for each directory using for loop.Let say if [ ! -d "$dir" ] is true then it will give some error message. now I face problem like the succesding if statements also executed. Here I cant use exit or break command because it comes out of program. goto command is not understood by sh shell. now my obejective is if any if condtion is true for any directory, it shoul dgive some error message and it should check for another directory which are stored in dir variable. So please help me if any one know. if any more infrmation need then please ask me. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|