[GLLUG] trying to write a script And how to restart pure-ftpd
Melson, Paul
PMelson at sequoianet.com
Fri Oct 17 17:46:45 EDT 2003
I don't know about pure-ftpd (though `kill -HUP` might work), but
accessing argv[] in a shell script is pretty easy. Each argument
becomes a shell environment variable in the format $[argv number].
> ./mywebscript.sh 192.168.2.1 80
In the above example, the value of $0 is "./mywebscript.sh", the value
of $1 is "192.168.2.1", and the value of $2 is "80".
Here's an example of how to use them in the script:
#!/bin/sh
if [ $1x = x ]; then echo "Usage: $0 <filename>"
exit 1
fi
if [ -e $1 ]; then echo "Parsing: ${1}"
else echo "File $1 does not exist."
exit 2
fi
This checks to see if the user entered an argument, then it checks to
see if a file with a name matching the argument exists.
Clear as mud?
PaulM
-----Original Message-----
How do I get command line arguments in a script?
e.g. myscript blah
And how do I restart the Pure-ftpd server?
More information about the linux-user
mailing list