LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 11-28-2010, 02:30 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Rep: Reputation: 49
Filename beginning with left bracket: file cannot be erased.


Kernel 2.6.21.5, Slackware 12.0

Hi:
I saved a page from Linuxquestions. It was saved under a filename beginning with '[' (left square bracket). And I now can't delete the file. Unfortunately I cannot send you a screenshot because opening a terminal in the GUI makes ls behave differently. I shall try to describe, assuming the file is in dir '.'. Also let '[SOLVED]foo.html' be the file in question:
Code:
$ ls
<the file is listed>
$ ls [*
/bin/ls: cannot access [*: No such file or directory
$
If I want the hdd to get rid of this file, what should I do? Any hint will be welcome.

EDIT: my mistake. I got confused. The file has just been erased: 'rm -r [*'.

Last edited by stf92; 11-28-2010 at 03:05 AM.
 
Old 11-28-2010, 02:54 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
For what it's worth, you could also have removed it by escaping the bracket, i.e. "rm \[...".
 
Old 11-28-2010, 03:00 AM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Original Poster
Rep: Reputation: 49
Yes, I tried that too. Only I was trying in the wrong directory! But, as I always have trouble distinguishing regexps from expresions to be interpreted by the shell, your observation is valuable, as I can now apply it as a general rule. Regards.
 
  


Reply

Tags
ls, rm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Erased my .xsession file Little Dump Linux - Newbie 5 12-11-2008 12:49 AM
Change name of backup file in ext3 from filename~ to .filename~ Libu Linux - General 2 07-21-2008 10:29 PM
Handling filename beginning with '--' in bash vjimin Linux - Newbie 2 02-07-2006 05:18 AM
Uh-oh. Erased /dev/dvd file newmoon Linux - General 18 07-27-2005 01:12 PM
accidentily erased /dev/ttyS0 file frieza Linux - Hardware 1 01-02-2004 01:45 PM


All times are GMT -5. The time now is 11:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration