The branch, master has been updated
       via  591c224 Improve lsh's handling of -l user option w/cd.
      from  b223d96 Add some temp-name dot heuristics for OS X's sake.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 591c224584c04e0d6f58ece969946bd5472f7c89
Author: Wayne Davison <way...@samba.org>
Date:   Sat Apr 9 08:33:55 2011 -0700

    Improve lsh's handling of -l user option w/cd.

-----------------------------------------------------------------------

Summary of changes:
 support/lsh |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/support/lsh b/support/lsh
index 65488dc..8ccc5a2 100755
--- a/support/lsh
+++ b/support/lsh
@@ -7,7 +7,6 @@
 # command.
 
 user=''
-prefix=''
 do_cd=y # Default path is user's home dir, just like ssh.
 
 while : ; do
@@ -22,14 +21,13 @@ while : ; do
 done
 
 if [ "$user" ]; then
-    prefix="sudo -H -u '$user'"
+    prefix=''
     if [ $do_cd = y ]; then
        home=`perl -e "print((getpwnam('$user'))[7])"`
-       # Yeah, this may fail, but attempts to get sudo to cd are harder.
-       cd $home
+       prefix="cd '$home' ;"
     fi
-elif [ $do_cd = y ]; then
-    cd
+    sudo -H -u "$user" sh -c "$prefix $*"
+else
+    [ $do_cd = y ] && cd
+    eval "${@}"
 fi
-
-eval $prefix "${@}"


-- 
The rsync repository.
_______________________________________________
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs

Reply via email to