I want to construct a bash script which contains nested double quotes. I've tried all of the usual tricks, in particular rprint
which everybody recommends. But nothing I've tried works.
In particular, rprint -v name "%q "
lets me nest quotes but I then can't deal with the \
's it puts in front of the quotes. Finally I settled on this extremely crude kludge:
shCommand=`echo !ssh -p $othPort!`
execThis=`echo rsync -e $sshCommand etc etc | tr '!' '"'`
eval $execThis
Thus execThis is what I want, i.e.,
rsync -e "ssh -p XXXX" etc etc
But there has to be a better way to do this since a) it's extremely crude and b) it won't work if I need the ! in following line --- there seems to be no special character that bash
never uses. Could somebody tell me what a real bash programmer would do in this instance? Thanks very much for any advice