summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhugues <hugues@a0e5b806-a6f9-0310-978d-cbce73f8a913>2007-05-16 11:30:16 +0000
committerHugues Hiegel <hugues@hiegel.fr>2008-03-07 14:15:12 +0100
commit04344bec779acce2b69487d63386191f54a9814f (patch)
treeb349355e2e23b5166236585d0598ee92fe678f1f
parent72896f1d1d0ae633d360aede3956d42036fd600d (diff)
Petits correctifs
git-svn-id: svn+ssh://hugues@maison/opt/svn/private/hugues@383 a0e5b806-a6f9-0310-978d-cbce73f8a913
-rw-r--r--.zlogin4
-rw-r--r--.zshrc7
-rw-r--r--01_Functions.zsh2
-rw-r--r--10_Environment.zsh2
4 files changed, 9 insertions, 6 deletions
diff --git a/.zlogin b/.zlogin
index fb12fb6..243e210 100644
--- a/.zlogin
+++ b/.zlogin
@@ -2,9 +2,9 @@
[ -f $ZDOTDIR/user:`whoami`/zlogin ] && source $ZDOTDIR/user:`whoami`/zlogin
[ -f $ZDOTDIR/.keychain ] && source $ZDOTDIR/.keychain
-which keychain >/dev/null 2>&1 && keychain --quiet --stop others --inherit any
+cmd_exists keychain && keychain --quiet --stop others --inherit any
#keychain --quiet --quick id_dsa
#keychain --quiet --quick 593F1F92
-which remind >/dev/null 2>&1 && remind -n
+cmd_exists remind && remind -n
diff --git a/.zshrc b/.zshrc
index 5ff5d81..7455049 100644
--- a/.zshrc
+++ b/.zshrc
@@ -31,13 +31,15 @@ UID=${UID:-`id -u`}
HOST=${HOST:-$(hostname -s)}
DOMAIN=${DOMAIN:-${$(hostname -d):-$(hostname -y)}}
+DEBUG=no
+
export USER HOST DOMAIN UID
if [ -d $ZDOTDIR ]; then
for script in $ZDOTDIR/??_*.zsh
do
- [ "$DEBUG" != "" ] && echo "${${script:t:r}/??_/}... ";
+ [ "$DEBUG" = "yes" ] && echo "${${script:t:r}/??_/}... ";
source $script
for i in "net:$DOMAIN" "host:$HOST" "user:$USER" "user:$SUDO_USER"
@@ -45,13 +47,14 @@ if [ -d $ZDOTDIR ]; then
specific_script=${script:h}/$i/${${script:t}/??_/}
if test -f $specific_script
then
+ [ "$DEBUG" = "yes" ] && echo "$i/${${specific_script:t:r}/??_/}... ";
source $specific_script
fi
done
done
fi
-if [ "`whoami`" = "root" ]
+if privileged_user
then
[ "`pwd`" = ~ ] && cd ~root
export HOME=~root
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 022a87d..9769e9a 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -49,7 +49,7 @@ cmd_exists ()
normal_user ()
{
- eval `grep -v '^[$#]' /etc/login.defs | tr -d '[:blank:]' | sed 's/^[A-Z_]\+/&=/'`
+ eval `grep -v '^[$#]' /etc/login.defs | grep "^UID_" | tr -d '[:blank:]' | sed 's/^[A-Z_]\+/&=/'`
test \( $UID -ge $UID_MIN \) -a \( $UID -le $UID_MAX \)
}
diff --git a/10_Environment.zsh b/10_Environment.zsh
index 5360382..07fbaef 100644
--- a/10_Environment.zsh
+++ b/10_Environment.zsh
@@ -30,7 +30,7 @@ export PAGER=less
## Quelle commande utiliser par défaut ?
export NULLCMD=cat
-cmd_exists dircolors && eval $(dircolors ~/.dir_colors 2>&- )
+cmd_exists dircolors && eval $(dircolors ~/.dir_colors)
export TZ="Europe/Paris"
export TIME_STYLE="+%Y-%b-%d %H:%M:%S"