This is getting a bit tricky. I have a shell script to create tasks in our JIRA. I'am running it on Ubuntu Server (a newbie).
I have a variable in the script as follows:
SCRIPT="curl -D- -u $USER:$PASSWORD -X POST --data @$SAMPLE_FILE -H \"Content-Type: application/json\" $REST_URL"
I echo this script and run it in using $SCRIPT my shell script. When i bash my script, it always returns an error "curl: (6) Couldn't resolve host 'application'".
But if i try to run the printed SCRIPT(which i echoed) alone, it creates a task. I know it is a small problem but i'm not able to get it!
Any suggestions?
exec "$SCRIPT"orexec $SCRIPTor$( $SCRIPT ). I need to test this when I am at home. Please also escape$SAMPLE_FILEand$USER:$PASSWORDusing\"since you cannot be sure if they contain whitespaces.