This is my first shell script program, so i think this is more likely a silly question for you all.
Overview of problem My need is to write a shell command for installing our Node.js server.
- Server needs to install 3 crons as dependency. We offer 3 different environment.
Problem So when i try to assign cron(string) to variable then all the star in the string are replaced by filenames in the current working directory.
VAR1="*/1 * * * * /usr/bin/wget -O /var/tmp/output-folder-path https://my.server.com:12000/cron/push >> /dev/null 2>&1"
Now, when i do echo $VAR1
then output is like following
*/3 file1.txt file2.txt generated.txt sample.sh file1.txt file2.txt generated.txt sample.sh file1.txt file2.txt generated.txt sample.sh file1.txt file2.txt generated.txt sample.sh /usr/bin/wget -O /var/tmp/output-folder-here https://my.server.com:12000/cron/push >> /dev/null 2>&1
Output of ls
command in that directory is
file1.txt file2.txt generated.txt sample.sh
"$VAR1"
instead of$VAR1
. – Celada Apr 09 '15 at 06:27