[plug] script error

Mr E_T troll at arach.net.au
Thu Jan 12 18:00:04 WST 2006


On Thursday 12 January 2006 17:02, Craig Ringer wrote:
> Mr E_T wrote:
> AFAIK permissions are only affected by the >> redirect operator if the 
> second file must be created. In that case, I think the file is created 
> according to the umask, so you would need to change the permissions if 
> you need to override the defaults.
> 
> Usually, you're better off setting the umask at the beginning of the 
> script. Please don't just write a hard-coded umask unless you REALLY 
> know you need it; just set or clear the bits you absolutely need to 
> control using the `&' and `|' binary operators.
> 
> I really hate it when programmers blindly set the `umask'. Not that I'm 
> looking at you, Mozilla project, or anything...
He is trying to replace a particular file - I only use that method to
exacly copy the existing permisions of the original file.
But yes the umask methos or chmod +x etc is generally best.
Just in this situation a copy of the existing permisions is what is wanted.
and they may not match what is expected.

> 
> > cat $omail/$1 > $cmail/$1
> > cat $tmail/$1 >> $cmail/$1
> > 
> > Notice the first cat is a single > this creates or zreos the file first.
> 
> Strictly, it truncates it, creating it if it does not exist. It doesn't 
> as such zero anything. If I have a 1MB file "spam" and run:
I was trying to keep it simple

> $ info '(bash.info.gz)Shell Parameter Expansion'
> 
> This will teach you a LOT about smarter ways to manipulate the data you 
> work with. You'll find it much less necessary to break out to `sed', 
> `awk', or edit pipelines with `cut' and friends.
I have found that this is true

> 
> The bash manual isn't easy to find things in, can be rather dense, and 
> isn't the best organized ... but it is very complete. Please don't 
> ignore it.
true

-- 
regs MR E_T
_______________________
\                      \
  \   OOHH I hate TYPOS  \
    \                      \
      ~~~~~~~~~~~~~~~~~~~~~~~



More information about the plug mailing list