From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28514 invoked from network); 12 Sep 2000 22:00:25 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Sep 2000 22:00:25 -0000 Received: (qmail 24014 invoked by alias); 12 Sep 2000 21:59:38 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3422 Received: (qmail 24007 invoked from network); 12 Sep 2000 21:59:37 -0000 Date: Tue, 12 Sep 2000 17:59:28 -0400 Message-Id: <200009122159.RAA11176@soup.ads.apexinc.com> X-Authentication-Warning: soup.ads.apexinc.com: ejb set sender to ejb@apexinc.com using -f From: "E. Jay Berkenbilt" To: zsh-users@sunsite.auc.dk Subject: a nice su function Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII 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 }