
On Fri, 12 Aug 2005 08:28, Jonathan Purvis wrote:
Does anyone know how to get bash to split the output of a command enclosed in `` the same way it would split the command line if typed in? Everything i do to try to escape spaces ends up not working. Eg, this command (for sorting the songs from _The Dark Side Of Phobos_ in level order) produces a string that can be cut'n'pasted to bash, but if i change the echo command to mplayer, it doesn't work as bash split on spaces.
echo `find . -name '*E1M*' | awk '{print $2,$0}' FS='[()]' | sort | sed -e 's/[^ ]* \(.*\)/\1/' -e 's/\([ ()]\)/\\\\\1/g'`
Make sure you are using the version of echo you need, ie the bash builtin command or one installed on your filesystem in eg /bin. -- Professor Farnsworth: "He may have ocean madness, but that's no excuse for ocean rudeness."