bash - Weird output while passing parameter to script -
hi passing parameter shell script , getting weird result .below script-:
#!/bin/bash # set string variable path=$1 echo password | sudo -s -l sudo /usr/bin/su - abcd << eof cd $path #write out current crontab crontab -l > $2 #echo new cron cron file echo $3 #echo $3 >> $2 #install new cron file #crontab mycron eof
above works fine, goes on specified path,and create backup file when goes echo $3 gives wrong result (weird long string can not show here).but gives output if pass parameter belw
./createnewcron.sh /u/siebel/abcd backing.txt "00 09 * * 1-5"
but when pass string below works fine-:
./createnewcron.sh /u/siebel/abcd backing.txt "echo hello"
can explain me why? thanks
the shell expands *
script receives files in directory. display stars, need quote echo
echo "$3"
Comments
Post a Comment