Monday, August 4, 2008

When is a File not a File?

Ok unix gurus... I need your help again! I have two questions:

1. How did this happen?

bash-3.00$ ls htklats | head
{}
1087_03_37_05_20000706_usr001.gz
1087_03_37_05_20000706_usr002.gz
1087_03_37_05_20000706_usr003.gz
1087_03_37_05_20000706_usr004.gz
1087_03_37_05_20000706_usr005.gz
1087_03_37_05_20000706_usr006.gz
1087_03_37_05_20000706_usr007.gz
1087_03_37_05_20000706_usr008.gz
1087_03_37_05_20000706_usr009.gz

2. How can I get rid of it? (Cause rm doesn't work).

bash-3.00$ rm {}
rm: cannot remove `{}': No such file or directory

Here's what else I know about this mutant "thing":

bash-3.00$ ls -l {}
ls: {}: No such file or directory


bash-3.00$ ls -l
total 0
lrwxrwxrwx 1 amydash ssli 2 Aug 4 20:15 {} -> {}
lrwxrwxrwx 1 amydash ssli 88 Aug 4 20:16 1087_03_37_05_20000706_usr001.gz -> /g/ssli/transitory/amydash/emotion/forced_alignment/out/1087_03_37_05_20000706_usr001.gz

3 comments:

Me said...

A couple of quick things to try:

rm \{\}

or

ls ??

make sure it's the only file listed, then

rm ??

Amy said...

Nice, the ?? thing totally worked!! What does ?? mean?

Me said...

It's a single-character wildcard, so it's like * but for only a single character. Incidentally, if you had more than one two-letter filename in the directory, most versions of unix allow you to do rm -i ??, where the -i makes it ask you to confirm each file deletion, so you can step through (carefully) until you get to the file you want to delete.

Cheers!