On Fri, Jul 07, 2017 at 05:47:46AM BST, Raf Czlonka wrote:
> Hi all,
>
> I've noticed that etc/ksh.kshrc uses both types of command substitution
> `command` and $(command). The below diff unifies it and uses
> $(command) notation consistently.
>
> While there, [...] remove basename(1) invocation and use parameter
> expansion instead.
> [...]
>
Hi all,
Take two - only the above. Already got OKs from rpe@ so, if there
are no objections, would someone be so kind as to committing it,
please? :^)
Cheers,
Raf
Index: etc/ksh.kshrc
===================================================================
RCS file: /cvs/src/etc/ksh.kshrc,v
retrieving revision 1.27
diff -u -p -r1.27 ksh.kshrc
--- etc/ksh.kshrc 14 Sep 2016 18:34:51 -0000 1.27
+++ etc/ksh.kshrc 15 Jul 2017 05:45:01 -0000
@@ -39,7 +39,7 @@ case "$-" in
0) PS1S='# ';;
esac
PS1S=${PS1S:-'$ '}
- HOSTNAME=${HOSTNAME:-`uname -n`}
+ HOSTNAME=${HOSTNAME:-$(uname -n)}
HOST=${HOSTNAME%%.*}
PROMPT="$USER:!$PS1S"
@@ -49,8 +49,8 @@ case "$-" in
PS1=$PPROMPT
# $TTY is the tty we logged in on,
# $tty is that which we are in now (might by pty)
- tty=`tty`
- tty=`basename $tty`
+ tty=$(tty)
+ tty=${tty##*/}
TTY=${TTY:-$tty}
# $console is the system console device
console=$(sysctl kern.consdev)
@@ -117,7 +117,7 @@ case "$-" in
alias o='fg %-'
alias df='df -k'
alias du='du -k'
- alias rsize='eval `resize`'
+ alias rsize='eval $(resize)'
;;
*) # non-interactive
;;
@@ -142,6 +142,6 @@ function pre_path {
}
# if $1 is in path, remove it
function del_path {
- no_path $* || eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: |
- sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"`
+ no_path $* || eval ${2:-PATH}=$(eval echo :'$'${2:-PATH}: |
+ sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;")
}