From 0ba52eeb8e70bbb61464f9ff44e6df0c4d437949 Mon Sep 17 00:00:00 2001 From: rpe <> Date: Fri, 9 Sep 2016 16:25:37 +0000 Subject: [PATCH] Convert [] to ksh style [[]] tests. Based on a diff from Anthony Coulter. OK krw, halex --- src/etc/ksh.kshrc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/etc/ksh.kshrc b/src/etc/ksh.kshrc index 224049a2..e6aaffd4 100644 --- a/src/etc/ksh.kshrc +++ b/src/etc/ksh.kshrc @@ -1,5 +1,5 @@ : -# $OpenBSD: ksh.kshrc,v 1.21 2016/09/09 16:11:12 rpe Exp $ +# $OpenBSD: ksh.kshrc,v 1.22 2016/09/09 16:25:37 rpe Exp $ # # NAME: # ksh.kshrc - global initialization for ksh @@ -65,7 +65,7 @@ case "$-" in case "$TERM" in sun*-s) # sun console with status line - if [ "$tty" != "$console" ]; then + if [[ $tty != $console ]]; then # ilabel ILS='\033]L'; ILE='\033\\' # window title bar @@ -84,7 +84,7 @@ case "$-" in *) ;; esac # do we want window decorations? - if [ "$ILS" ]; then + if [[ -n $ILS ]]; then function ilabel { print -n "${ILS}$*${ILE}">/dev/tty; } function label { print -n "${WLS}$*${WLE}">/dev/tty; } @@ -139,11 +139,11 @@ function no_path { } # if $1 exists and is not in path, append it function add_path { - [ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1" + [[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1" } # if $1 exists and is not in path, prepend it function pre_path { - [ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}" + [[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}" } # if $1 is in path, remove it function del_path {