#1
  1. The Evil Monkey
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    220
    Rep Power
    12

    Question 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!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    137
    Rep Power
    0
    rm 'a a' <- single quotes
    or
    rm a\ a <- escape (\) the special character
    or
    rm "a a" < double quotes

IMN logo majestic logo threadwatch logo seochat tools logo