Hi,
I'm new to UNIX, at least shell programming and am having trouble figuring out a problem i'm having. In one section in my nested if statement, i want the program to test if the file does not exist, based on an argument supplied at the command line by the user. What i have is
PHP Code:
elif [ -e !$4 ]; then
echo "Message: File \"$4\" does not exist. Creating new file."
touch $4
cp $2 $4
set error=o
and from there it goes down a long list of other conditions, but this is the only one giving me problems. It skips completely over it and doesnt print anything to screen.
Another problem i'm having is with error codes. I want certain error code values to display if the user should decide to ask for the error code level at the command line, using a logical AND in addition to the arguments supplied for the main part of hte program. I tried changing the last line in all of my nested ifs to
PHP Code:
set $?=<error code i wanted>
bu that threw an error saying an assignment was attempted on a nonvariable. OK fine, so how would this be done? Is it even possible to set up specified error codes in a shell script that you can call by using 'echo $?' ?
Any help is appreciated, thanks !!
Using BASH shell btw.