Change [ to [[ and ~ to $HOME.

This commit is contained in:
Darren 'Tadgy' Austin 2019-07-01 15:29:32 +01:00
commit 2b57c9a4c3
3 changed files with 19 additions and 19 deletions

View file

@ -2,11 +2,11 @@
# Clear the screen/console on logout.
if (( $SHLVL == 10 )); then
if [ -x /usr/bin/clear_console ]; then
if [[ -x /usr/bin/clear_console ]]; then
/usr/bin/clear_console -q
elif [ -x /usr/bin/clear ]; then
elif [[ -x /usr/bin/clear ]]; then
/usr/bin/clear
elif [ -x /usr/bin/tput ]; then
elif [[ -x /usr/bin/tput ]]; then
/usr/bin/tput clear
else
echo -ne "\E[2J"

View file

@ -1,5 +1,5 @@
# Souce bash specific set up,
[ -f ~/.bashrc ] && . ~/.bashrc
[[ -f ~/.bashrc ]] && . ~/.bashrc
# Environment.
export EDITOR="nano"
@ -11,17 +11,17 @@ export MANPAGER="less -Mis -PM'Page %dt$'"
export PAGER="less"
export PATH="/usr/local/sbin:/usr/sbin:/opt/sbin:/sbin:$PATH"
export VISUAL="$EDITOR"
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
[[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)"
# Platform specific set up.
_PLATFORM="$(uname -s)"
if [ "$_PLATFORM" = "Linux" ]; then
if [[ "$_PLATFORM" = "Linux" ]]; then
export I_WANT_A_BROKEN_PS=1
export LYNX_CFG="$HOME/.lynx.cfg"
export LYNX_LSS="$HOME/.lynx.lss"
export MANPATH="~/.local/share/man:$MANPATH"
export MANPATH="$HOME/.local/share/man:$MANPATH"
hash dircolors >/dev/null 2>&1 && eval "$(dircolors -b ~/.dir_colors)"
elif [ "$_PLATFORM" = "Darwin" ]; then
elif [[ "$_PLATFORM" = "Darwin" ]]; then
export LSCOLORS="ExGxdxdxCxDxDxbcacbeae"
export MANPATH="/opt/local/share/man:$MANPATH"
export PATH="/opt/local/sbin:/opt/local/bin:$PATH"
@ -31,9 +31,9 @@ fi
unset _PLATFORM
# Add bin directories to PATH.
[ -d "$HOME/files/bin" ] && export PATH="$HOME/files/bin:$PATH"
[ -d "$HOME/.local/bin" ] && export PATH="$HOME/.local/bin:$PATH"
[ -d "$HOME/bin" ] && export PATH="$HOME/bin:$PATH"
[[ -d "$HOME/files/bin" ]] && export PATH="$HOME/files/bin:$PATH"
[[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH"
[[ -d "$HOME/bin" ]] && export PATH="$HOME/bin:$PATH"
# Make ssh-agent work better.
hash ssh-add ssh-agent >/dev/null 2>&1 && {
@ -95,13 +95,13 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && {
# Screen.
hash screen >/dev/null 2>&1 && {
if [ ! -e ~/.hushlogin ]; then
if [ ! -z "$STY" ]; then
if [[ ! -e ~/.hushlogin ]]; then
if [[ ! -z "$STY" ]]; then
echo "Screen $STY, window $WINDOW."
echo
else
_SCREENS="$( screen -ls | grep '[[:alpha:]]' | egrep -v '^([[:digit:]]+|No) Socket(s)?' )"
if [ -n "$_SCREENS" ]; then
if [[ -n "$_SCREENS" ]]; then
echo "$_SCREENS"
echo
else
@ -114,9 +114,9 @@ hash screen >/dev/null 2>&1 && {
}
# Mail check.
[ ! -z "$SSH_CONNECTION" ] && {
if [ -s /var/spool/mail/$USER ]; then
if [ -N /var/spool/mail/$USER ]; then
[[ ! -z "$SSH_CONNECTION" ]] && {
if [[ -s /var/spool/mail/$USER ]]; then
if [[ -N /var/spool/mail/$USER ]]; then
echo "You have new mail."
echo
else

View file

@ -155,7 +155,7 @@ PS4="+(\[\e[33m\]\\\$? = \$?\[$(tput sgr0)\]) \[$(tput bold)$(tput setaf 4)\]\${
# Platform specific set up.
_PLATFORM="$(uname -s)"
if [ "$_PLATFORM" = "Linux" ]; then
if [[ "$_PLATFORM" = "Linux" ]]; then
# Linux specific aliases.
hash ftpwho >/dev/null 2>&1 && alias ftpwho='ftpwho -v'
hash iftop >/dev/null 2>&1 && alias iftop='TERM=vt100 iftop'
@ -171,7 +171,7 @@ if [ "$_PLATFORM" = "Linux" ]; then
psgrep() {
ps -auwwx | egrep "(RSS|$1)"
}
elif [ "$_PLATFORM" = "Darwin" ]; then
elif [[ "$_PLATFORM" = "Darwin" ]]; then
# Darwin specific aliases.
hash df >/dev/null 2>&1 && alias df='df -P'
hash ls >/dev/null 2>&1 && alias ls='ls -bFG'