[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Accented chars in filenames issue



On 25/06/11 19:35, Andrew McGlashan wrote:
> Scott Ferguson wrote:
<snipped>
> 
> The first part "*" removed both files AND any other file that might have
> been in the directory.

There, we'll have to disagree. Perhaps your shell handles ls
differently. Also you are running as root, I'm not

scott@work:~/spec$ ls -a
.  ..

Look - nothing there kids :-)

scott@work:~/spec$ touch "*" "&"
scott@work:~/spec$ ls -a
.  ..  *  &

Is now! (for my next trick I'll need a wealthy volunteer from the audience)


> 
> #  touch \* \&
> #  ls -A
> *  &
> #  ls -A|xargs rm
> #  ls
> 
> 
> No error there, smaller hammer ;-)
> 
> 
> And just to show that it doesn't clear other files....
> 
> #  touch \* \& a b c
> #  ls
> *  &  a  b  c
> #  ls -A \* \&
> *  &
> #  ls -A \* \&|xargs rm
> #  ls
> a  b  c
> 
> 
> Just for fun, to also prove that the "*" is a problem with the other

Which is where you lose me. Problem?

> smaller hammer attempt:
> 
> #  touch \* \& a b c
> #  ls
> *  &  a  b  c
> #  rm $(ls -A)
> rm: cannot remove `&': No such file or directory
> rm: cannot remove `a': No such file or directory
> rm: cannot remove `b': No such file or directory
> rm: cannot remove `c': No such file or directory
> #  ls
> 
> 
> Do I need to tell anybody that I *like* these types of problems?    LOL
> 
> Cheers
> 

Can't say I "like" these types of problems ... :-)

scott@work:~/spec$ ls -a
.  ..
scott@work:~/spec$ touch "*" "&" "a" "b" "c"
scott@work:~/spec$ ls -al
total 16
drwxr-xr-x  2 scott scott  4096 Jun 25 20:10 .
drwxr-xr-x 72 scott scott 12288 Jun 25 18:57 ..
-rw-r--r--  1 scott scott     0 Jun 25 20:10 *
-rw-r--r--  1 scott scott     0 Jun 25 20:10 &
-rw-r--r--  1 scott scott     0 Jun 25 20:10 a
-rw-r--r--  1 scott scott     0 Jun 25 20:10 b
-rw-r--r--  1 scott scott     0 Jun 25 20:10 c
scott@work:~/spec$ rm *
scott@work:~/spec$ ls -a
.  ..

Another way to make nice slippers from a feline:-
scott@work:~/spec$ touch "*" \& a 'b' c


My preferred solution (apart from *not* doing this sort of thing as root):-
$ touch \* \& a b c
$ rm *

The proof of the pud.... ;-p

Cheers

-- 
I'm tired of this back-slapping "Isn't humanity neat?" bullsh#t. We're a
virus with shoes, okay? That's all we are.
~ Bill Hicks


Reply to: