I have a shell script I am trying to get working. I need the output to be a certain way and I know I'm just not escaping the characters correctly.
#!/bin/bash set -x DATE=$(date +%Y-%m-%d-%M) ELEMENTS="ele1,ele2,ele3" TOPIC="dogs cats" FILE="./$DATE.csv" COMMAND="python /home/script.py" $COMMAND $ELEMENTS "$TOPIC" | tee -a $FILE
What happens from set in the terminal when I run it is:
++ date +%Y-%m-%d-%M + DATE=2016-02-01-21 + ELEMENTS=a list of elements + TOPIC='dogs cats' + FILE=./2016-02-01-21.csv + COMMAND='python /home/script.py' + python /home/script.py ele1,ele2,ele3 'dogs cats' + tee -a ./2016-02-01-21.csv
What I need it to be is "dogs cats" vs 'dogs cats'. The python command requires double quotes for multi word strings.
This is wheezy running on a raspberry pi.