PDA

View Full Version : Need help to remove one Temporary file




kingofkind
Jun 6, 2013, 02:21 PM
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
Jun 6, 2013, 02:27 PM
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:


echo ~\$file.xlsm
echo ~$file.xlsm

kingofkind
Jun 6, 2013, 02:34 PM
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?

old-wiz
Jun 6, 2013, 09:09 PM
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 \

itickings
Jun 7, 2013, 02:50 AM
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 $.

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? ;)

old-wiz
Jun 7, 2013, 09:55 AM
guess I'm feeling backwards today..

itickings
Jun 7, 2013, 12:41 PM
On the plus side - the backlash wasn't too bad.