George Georgalis wrote:
..
..script needs to generate files with the same umask
of $USER which is different from the system umask, and can change
>from user to user.
Situation, when that is run as tested (login shell), all is fine.
a umask of 007 is applied to files created. But when it's deposited
in the $PATH directory and run as "doit.sh" it uses the system umask.
Hey Jim! how the heck are you?
(hi george -- I'm fine; been off the list a while, but I'iiim baaack!)
..just a utility to change dos <-> unix text files
and accepts $1, so
doit.sh file.txt
replaces that file
ok, _beginning_ to understand the question a little better, but I still
don't see how to reproduce the problem -- maybe there's still something
missing?
Whether you run ./doit.sh via (#!/usr/bin/sh), or sh doit.sh or even sh
-c ./doit.sh, that's an non-interactive shell in all cases, I believe.
Even if there were, on FC4, there should still be no difference in umask
(see following discussion).
I note that in FC4, my /etc/bashrc contains
-------------------------------------------------------
# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
# are we an interactive shell?
if [ "$PS1" ]; then
<snip.. nothing affecting umask>
--------------------------------------------------------
Now, again on my unmodified FC4, /etc/bashrc gets invoked from my ~/.bashrc
Hmmm, maybe your /etc/bashrc or ~/.bashrc is different?
Here's another test script you may find useful
--------------------------------------------------------
#!/bin/sh
UMASK=`umask`
echo "$0 entry: ps1='$PS1' user=='$USER' shlvl='$SHLVL' umask='$UMASK'
args='$*'"
#in case of wrap, 'echo' above is one line
[ 0 -eq $UID ] && exec su - jsack -c "$0 $*"
echo "==="
--------------------------------------------------------
If you aren't interested in the behavior when run as root, you can
probably leave off the test..exec line -- I just thought it was neat <g>.
..jim
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list