September 24th, 2003, 04:24 PM
Escape characters in a move command?
I am trying to create a shell script for the ksh shell. The script is intended to scan a directory looking for improper characters in the filenames. If it finds any, it moves the file using mv from the old filename to the new filename. The trouble is, you cannot move the file because it has improper characters in the filename!
So the question is, how can I escape those illegal characters? The types of characters I'm dealing with are like the ampersand, quotes, or the plus/minus symbol, which I think is just a converted whitespace.
How can I escape these characters when doing a move command? I already tried putting a backslash before each one and it didn't work.
Any input is welcome. Thanks!
September 24th, 2003, 04:58 PM
rm 'a a' <- single quotes
rm a\ a <- escape (\) the special character
rm "a a" < double quotes