Chris Roberts
2022-04-01 16:21:20 UTC
How can I get this to recognize a filename with a space?
I am manipulating files in my script, but at the portion where I want to do a diff. I cannot get it to work.
Would someone out there know of a workaround? (Besides saying "don't have filenames with spaces in them). :-)
This is in bash:
uno="try this.txt"
dos=blah.pdf
echo "$uno" "$dos" | xargs -l bash -c 'echo uno:$0 dos:$1' | xargs
#OUT: uno:try dos:this
echo "$uno" "$dos" | xargs -l bash -c 'echo uno:$0 dos:$1'
#OUT: uno:try dos:this
echo uno:"$uno", dos:"$dos" #this works, but doesn't help in my script.
#OUT: uno:try this.txt, dos:blah.pdf
thanks,
crzzy1
I am manipulating files in my script, but at the portion where I want to do a diff. I cannot get it to work.
Would someone out there know of a workaround? (Besides saying "don't have filenames with spaces in them). :-)
This is in bash:
uno="try this.txt"
dos=blah.pdf
echo "$uno" "$dos" | xargs -l bash -c 'echo uno:$0 dos:$1' | xargs
#OUT: uno:try dos:this
echo "$uno" "$dos" | xargs -l bash -c 'echo uno:$0 dos:$1'
#OUT: uno:try dos:this
echo uno:"$uno", dos:"$dos" #this works, but doesn't help in my script.
#OUT: uno:try this.txt, dos:blah.pdf
thanks,
crzzy1