I am fairly new to bash, so I don\'t know where this problem is appearing. But, I have this script, which is supposed to just change cd, download a tar file and extract it. I
As edited, your script now says that you're running
#!/bin/bash
`cd /usr/local/src`
`wget http://nginx.org/download/nginx-1.6.2.tar.gz -O nginx-1.6.2.tar.gz`
`tar -xzf nginx-1.6.2.tar.gz`
The backticks cause each command to be run in a subshell; and each subshell's output to be read, string-split, and run as a second command.
Also, because the cd
is in a subshell, its effects don't carry over to the main shell.
So: Remove the backticks (and make sure your script exits if the cd
fails; I do this here with the -e
flag). You should only be running:
#!/bin/bash -e
cd /usr/local/src
wget http://nginx.org/download/nginx-1.6.2.tar.gz -O nginx-1.6.2.tar.gz
tar -xzf nginx-1.6.2.tar.gz
...which is to say: Your commands must not start and end with ` characters.