#!/bin/sh
if [ -n "$1" ]
then
echo -n "option is not null, you input is \""
echo $1\"
else
echo "option is null"
fi
exit
[beyes@groad shell]$ ./cmdnull.sh
option is null
[beyes@groad shell]$ ./cmdnull.sh hello
option is not null, you input is "hello"
#!/bin/sh
E_WRONGPRAM=6
case "$1" in
"") echo "input null";;
*[!0-9]*) echo "Usage: `basename $0` file-name"; exit $E_WRONGPRAM;;
*) echo $1;;
esac
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |