zsh-users
 help / color / mirror / code / Atom feed
* a nice su function
@ 2000-09-12 21:59 E. Jay Berkenbilt
  0 siblings, 0 replies; only message in thread
From: E. Jay Berkenbilt @ 2000-09-12 21:59 UTC (permalink / raw)
  To: zsh-users


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
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-09-12 22:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-12 21:59 a nice su function E. Jay Berkenbilt

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).