• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Personal linux shell work environment


Commit MetaInfo

Revisiónd21c29b5eaaabe6f0de240253d6275f096a373ba (tree)
Tiempo2020-03-25 23:13:23
AutorAntoon Pardon <antoon.pardon@rece...>
CommiterAntoon Pardon

Log Message

make su work when it starts a login session

Cambiar Resumen

Diferencia incremental

diff -r 966fbb4f78bb -r d21c29b5eaaa su
--- a/su Wed Aug 01 12:23:17 2018 +0200
+++ b/su Wed Mar 25 15:13:23 2020 +0100
@@ -2,12 +2,16 @@
22
33 . ${SHRC}
44
5-if [ $# -eq 0 ]
5+LOGIN=""
6+
7+if [ $# -gt 0 -a "$1" = "-" ]
68 then
7- set root -c "exec bash"
9+ LOGIN="-"
10+ shift
811 fi
12+
913 OLDUSER=$USER
10-NEWUSER=${1}
14+NEWUSER=${1:-root}
1115 if [ "$NEWUSER" = "root" ]
1216 then
1317 TITLE=$(echo root@${HOSTNAME} | tr '[:lower:]' '[:upper:]' )
@@ -15,5 +19,5 @@
1519 TITLE=${NEWUSER}@${HOSTNAME}
1620 fi
1721 push-title $TITLE
18-/usr/bin/su "$@"
22+\su $LOGIN "$@"
1923 pop-title