POV-Ray : Newsgroups : povray.off-topic : Adventures with digital painting : Re: Adventures with digital painting Server Time
14 Nov 2024 22:24:59 EST (-0500)
  Re: Adventures with digital painting  
From: Warp
Date: 8 Mar 2008 19:04:18
Message: <47d32982@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> 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".

  Only if you write "~John.tmp" by hand instead of letting the shell do
the proper expansion.

>  And if you want to delete all the files in 
> the directory, you have to add more escaping.

  Well, if "rm *" works (ie. there aren't too many files), you don't.
If there are too many files, I suppose you'll have to use the 'find'
trick.

> And if you want to scp 
> them to a different server, you really don't want to be typing the 
> password for each one

  If you do a "scp *" it won't ask 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.

  What's the problem with tarring them? "tar -cvf . files.tar"

> Anyway, my point was that it's kind of unobvious to get right

  Granted, the only problem I have seen so far is when there are way
too many files in the directory, in which case "*" expand to too many.
However, I haven't seen any problems with special characters so far.

> 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.

  The only valid point you have presented is the too-many-files argument,
which can be a real problem for the * expansion. So far I haven't seen
any real problem with special characters.

> 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. :-)

  What's wrong with getting the command from the command history with
the up cursor, going to the beginning of the line with ctrl-a and then
adding the "sudo" there?

> 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. :-)

  Still many shell scripts fail to use the basic "$@" for the correct
expansion of all the parameters (and instead use $*, which is wrong).
Not all unix geeks know all the right tools either.

-- 
                                                          - Warp


Post a reply to this message

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