Results 1 to 2 of 2
I create a bash script with using case syntax. My bash script option must be " ./script user hello ". Below is the content of the script.
user=`echo "$1" | ...
- 12-14-2009 #1Linux Newbie
- Join Date
- Mar 2006
- Posts
- 101
help me in my bash script
I create a bash script with using case syntax. My bash script option must be "./script user hello". Below is the content of the script.
I want to modify it and do something like this.
user=`echo "$1" | sed "s/$/@foo.com/"`
case $1 in
*)
echo "From: $user
TEST1" > /var/log/test1
echo -n " TEST2" > /var/log/test2
;;
esac
If I run the script ./script user (without the word "hello"), it will echo -n " TEST2" > /var/log/test2, if I run the script ./script user hello, it will return echo -n " TEST1". I'm thinking if I can do this using if syntax though I'm not sure and still checking if can do this.
Ant advise?
- 12-14-2009 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
Google: bash scripting
Bash Scripting Guide
Chapter 7 - Tests


Reply With Quote