Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you deal with a space in a filename in Terminal???
#1
OK.. I'm using Apple Remote Desktop to send a terminal command, run as root, to 30 computers.

Example;
chflags nouchg /Users/Shared/Application Aliases/•Games/Deimos Rising
rm -f /Users/Shared/Application Aliases/•Games/Deimos Rising

Unlock the file, and remove the file...
It seems to be choking on the spaces in the directory names...


How do I "phrase" things so it will do what I'm trying to do?

(I'd just go to each computer, but this is an experiment before running the same thing on 130 MORE computers....).


I know I"m close here...
Tips appreciated!
Reply
#2
An example of the output from ARD;

Lab 02 (192.168.69.129)
chflags: /Users/Shared/Application: No such file or directory
chflags: Aliases/•Games/Deimos: No such file or directory
chflags: Rising: No such file or directory


It no likey the space...
Reply
#3
put the file or directory name in quotes.
Reply
#4
That'll work, but the more official way to do it is to use a '\' (without the quotes. Just the slash) before the space. It essentially means that anything that comes after it, take it exactly how it is.
Reply
#5
dragging the file into the terminal will escape special chars automagically
Reply
#6
Quotes got it...
"\" got it...

Can't really drag it into Terminal the way I'm doing it (using ARD), but I'll keep it in mind!

Thanks guys! You just saved me several hours of visiting 26 classrooms! Big Grin
Reply
#7
You shouldn't have files or paths with spaces. :-)
Reply
#8
Sure.. I know that NOW.. but I'm stuck with the hand I've been dealt for now Smile
Reply
#9
[quote Greg the dogsitter]You shouldn't have files or paths with spaces. :-)
While we're at it, just stick with 8.3 filenames and you'll be fine no matter what you do.

Living in 1980 is nice, isn't it?

Or is that, Living\ in\ 1980\ is\ nice,\ isnt\ it?
Reply
#10
[quote Greg the dogsitter]You shouldn't have files or paths with spaces. :-)
Tell that to Apple. Looked in any of your /Library folders lately? Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)