Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
a nice su function
- X-seq: zsh-users 3422
- From: "E. Jay Berkenbilt" <ejb@xxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: a nice su function
- Date: Tue, 12 Sep 2000 17:59:28 -0400
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
I like to use zsh when I'm root as well as when I'm myself, so I have
this little su function I threw together. I post it here in case
others may find it useful and in case someone may point out a better
way to do something I've done here. Basically, if I don't specify -
or -f I want -fc /bin/zsh appended to whatever I pass to su.... This
function seems to do the trick for me.
function su
{
local add_args
local args
add_args=1
args=($*)
for i in $*; do
if [ $i = "-" ]; then
add_args=0
elif [ "${i:#-f*}" = "" ]; then
add_args=0
fi
done
args=($*)
if [ $add_args = 1 ]; then
args=($args -fc /bin/zsh)
fi
command su $args
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author