Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kingofkind

macrumors member
Original poster
May 30, 2011
43
0
Hi all,

I have recently been trying to learn Python scripting using LPTHW. While using terminal I came across a temporary file (~$file.xlsm) that shows up in terminal, but is not shown in Finder. running "rm ~$file.xlsm" does not work. Anyone have any suggestions?
 

itickings

macrumors 6502a
Apr 14, 2007
947
185
Code:
rm ~\$file.xlsm

If you don't escape the $, it is going to interpret $file as a variable and replace it with the content of that variable. Compare the outputs from the following two commands:

Code:
echo ~\$file.xlsm
echo ~$file.xlsm
 
Last edited:

kingofkind

macrumors member
Original poster
May 30, 2011
43
0
Thanks for the reply. the real file name also has spaces in it (I didnt name the file). When I run the rm it gives me three outputs. How do I tell the terminal to ignore the spaces?
 

itickings

macrumors 6502a
Apr 14, 2007
947
185
Thanks for the reply. the real file name also has spaces in it (I didnt name the file). When I run the rm it gives me three outputs. How do I tell the terminal to ignore the spaces?

Put it in quotes, or add \ before the spaces, just like before the $.

Code:
rm "name with spaces"
rm name\ with\ spaces

When asking for help it is generally a good idea to give an example that actually matches your problem instead of rewriting it into something else.

I don't remember exactly if it works in osx, but in *NIX you could use forward slash to allow unusual characters to be input...

ie \

Backslash, right? ;)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.