I am trying to make a script that runs through all the machines available and saves some data into my home folder.
machines=`cat $OAR_FILE_NODES | uniq`
for machine in ${machines}
do
echo "connecting to:" ${machine}
oarsh ${machine} 'tar -zcvf data_${machine}.tar.gz /tmp/data'
done
The problem is that all data gets saved to data_.tar.gz archive, overwriting it several times.
How can I make the shell substitute the variable machine into the command passed to oarsh?
oarshline? This way,$machinewill get expanded.oarsh ${machine} tar -zcvf "data_${machine}.tar.gz" /tmp/data?oarsh ${machine} "tar -zcvf data_${machine}.tar.gz /tmp/data".