POV-Ray : Newsgroups : povray.off-topic : Adventures with digital painting : Re: Adventures with digital painting Server Time
11 Oct 2024 09:19:53 EDT (-0400)
  Re: Adventures with digital painting  
From: Darren New
Date: 11 Mar 2008 13:08:24
Message: <47d6ca98@news.povray.org>
Warp wrote:
> 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.

Or if you pass it through another program that also tries to do the 
expansion. I.e., if it goes thru the shell more than once.

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

Yep. Then it gets very slow, or very complicated.

>   If you do a "scp *" it won't ask the password for each one.

Again, I tend to work with tens of thousands of files at once.

>> , 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"

If you want to select a subset of files to tar up, then it becomes very 
difficult.

> However, I haven't seen any problems with special characters so far.

Well, clearly we work on different kinds of things. And yes, shells have 
gotten way better lately, but if you wind up doing multiple passes 
through a shell (i.e., a shell script looping and calling another shell 
script) it gets messy.

>   The only valid point you have presented is the too-many-files argument,

See above. If you have a shell script to process something, it takes 
magic escaping.

Explain the "-0" argument to find and xargs if it isn't otherwise a problem?

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

Because it still doesn't work. SUDO doesn't kick in until after the 
output redirection is done, so "sudo echo xyz >pdq" doesn't overwrite pdq.

>   Still many shell scripts fail to use the basic "$@" for the correct
> expansion of all the parameters (and instead use $*, which is wrong).

That too. And it still doesn't work when there are too many files.  I'm 
not really sure why it's even limited, given I've got 16 gig of real 
memory and twice that of virtual memory. :-)

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