I'm writing a bash script to that will execute commands from a database. What I mean is that the MySQL database contains commands that bash will pull and then run itself.
My problem is that some of the commands contain single quotes, as needed by the shell app it plans to run. When I write a line like the one below directly in the bash script: `myapp -f dosomething -s 'do_some_other_thing -p some_more_things' -l end_of_my_line` It works fine.... but when I assign it to a variable like: COMMAND="myapp -f dosomething -s 'do_some_other_thing -p some_more_things' -l end_of_my_line" $COMMAND Then it will not execute properly. I don't know if the spaces inside the single quotes are the problem or if the single quotes themselves are the problem..... Can anyone give me some clues or another method to use? Thanks ahead of time for reading, and possibly giving any assistance. Juliodm. --UPDATE >From the terminal...... bash# myapp -f dosomething -s 'do_some_other_thing -p some_more_things' -l end_of_my_line works fine... also: bash# myapp -f dosomething -s "do_some_other_thing -p some_more_things" -l end_of_my_line also works fine... with double quotes... but from a script: MYVAR="myapp -f dosomething -s 'do_some_other_thing -p some_more_things' -l end_of_my_line" `$MYVAR` does not work and... MYVAR='myapp -f dosomething -s "do_some_other_thing -p some_more_things" -l end_of_my_line' `$MYVAR` does not work either...... I get: bash# "do_some_other_thing: cannot open shared object file: No such file or directory or bash# 'do_some_other_thing: cannot open shared object file: No such file or directory depending on wether I used single or double quotes...... I could really use some help here........ Can anyone give me some guidance...... please............ Juliodm. -- View this message in context: http://www.nabble.com/Interesting-problem-writing-bash-script-to-execute-commands-from-SQL-tp19203252p19203252.html Sent from the Gnu - Bash mailing list archive at Nabble.com.