POV-Ray : Newsgroups : povray.off-topic : Adventures with digital painting : Re: Adventures with digital painting Server Time
12 Oct 2024 01:13:47 EDT (-0400)
  Re: Adventures with digital painting  
From: Darren New
Date: 8 Mar 2008 18:46:26
Message: <47d32552$1@news.povray.org>
Warp wrote:
>   Why does it need to be so complicated?
>   find /tmp/stuff -name "*.tmp" -exec rm {} \;

>   It *does* work, assuming you have a sufficiently modern shell (and not
> a 20 years old sh). Modern shells are rather smart at escaping what needs
> to be escaped when you write "*".

In other words, if you completely bypass the shell, it can be made easy 
to work. Otherwise you get things like "no such user John.tmp" when you 
try to delete "~John.tmp".  And if you want to delete all the files in 
the directory, you have to add more escaping. And if you want to scp 
them to a different server, you really don't want to be typing the 
password for each one, so you either have to use xargs (with the -0 
switch, which is why that's there!) or manage to tar them up somehow, 
which has the same problems.

Anyway, my point was that it's kind of unobvious to get right, not that 
it couldn't be done.  I generally just break out Tcl for such a task 
(since Tcl doesn't reparse things repeatedly without you asking 
explicitly), as it's easier than trying to come up with the right list 
of flags to the various programs.

Yet every time I mention the kinds of problems it causes, the UNIX 
dweebs *I* know will fight to the death their need to be able to put 
backspaces and vertical tab characters into file names. You might as 
well try to convince a FORTH programmer that it isn't necessary to have 
the ability to start the name of a function with a closing parenthesis.
</rant>   :-)

Having the shell doing your expansion has caught me other times, too...

% cat a b c >d
Can't create d: permission denied
% sudo !!
Can't create d: permission denied

Of course, the real line was much longer, so a simple "su" meant 
retyping the line (or using copy-and-paste to retype it for you) instead 
of just !! or up-arrow. :-)

However, I'm glad Windows finally forced people writing Unix shells to 
start dealing with funky file names as a regular occurrence. ;-) I 
noticed that the shells started learning to do proper quoting (like for 
command-line completion) right around the time SAMBA shares with 
MSWindows servers got popular. :-)

-- 
   Darren New / San Diego, CA, USA (PST)
     "That's pretty. Where's that?"
          "It's the Age of Channelwood."
     "We should go there on vacation some time."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.