2
I am remote logged into a Mac and trying to copy a music file from one directory to another, but I am getting an error. I think it's caused by spaces or special characters, but not sure.
the file is:
01 Your Everything (feat. Louisahhh!).m4a
I tried a few variations of the following to cp the file (this is just a test to rename):
cp 01\ Your\ Everything\ (feat.\ Louisahhh!).m4a dd.m4a
I am getting the following error:
-bash: !: event not found
Thanks for reading!
1Ahh, wait adding escape characters to the ! and () characters did the trick. – Mrwolfy – 2013-01-12T02:54:14.717
2brackets should be fine, but it don't like that bang! I was going to suggest using autocomplete (<tab>) to see what the system thinks it's called, but no need now. Maybe next time – mcalex – 2013-01-12T02:56:40.487
1Thanks. I'll give it a try tomorrow, but escaping the brackets as well as the bang seemed to work. – Mrwolfy – 2013-01-12T04:23:35.560
Next time just do
cp "long filename with special characters.m4a" dd.m4a
– terdon – 2013-01-12T05:37:08.9302@terdon: double-quotes won't work, since it still interprets history substitutions (
!
) in them -- but single-quotes would do the trick. – Gordon Davisson – 2013-01-12T06:20:55.737