From 07c02f672a5708e4dcd9ed9aa3935840916f4c6e Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Wed, 2 Nov 2016 22:11:04 +0100 Subject: replace deprecated `...` syntax with $(...) in shell scripts --- lbu.in | 6 +++--- libalpine.sh.in | 8 ++++---- setup-acf.in | 4 ++-- setup-alpine.in | 2 +- setup-apkrepos.in | 4 ++-- setup-bootable.in | 2 +- setup-dns.in | 4 ++-- setup-hostname.in | 2 +- setup-interfaces.in | 8 ++++---- update-conf.in | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lbu.in b/lbu.in index 81eef2e..1cd767e 100644 --- a/lbu.in +++ b/lbu.in @@ -723,8 +723,8 @@ cmd_migrate_include_exclude() { #----------------------------------------------------------- # Main -cmd=`echo "$PROGRAM" | cut -s -d_ -f2` -PROGRAM=`echo "$PROGRAM" | cut -d_ -f1` +cmd=$(echo "$PROGRAM" | cut -s -d_ -f2) +PROGRAM=$(echo "$PROGRAM" | cut -d_ -f1) if [ -z "$cmd" ] ; then cmd="$1" [ -z "$cmd" ] && usage @@ -773,7 +773,7 @@ while getopts "adehlM:np:qrv" opt ; do ;; esac done -shift `expr $OPTIND - 1` +shift $(expr $OPTIND - 1) trap exit_clean SIGINT SIGTERM cmd_$SUBCMD "$@" diff --git a/libalpine.sh.in b/libalpine.sh.in index 760eaec..f3857e2 100644 --- a/libalpine.sh.in +++ b/libalpine.sh.in @@ -2,7 +2,7 @@ PREFIX=@PREFIX@ -PROGRAM=`basename $0` +PROGRAM=$(basename $0) : ${ROOT:=/} [ "${ROOT}" = "${ROOT%/}" ] && ROOT="${ROOT}/" @@ -12,7 +12,7 @@ echon () { if [ X"$ECHON" = X ]; then # Determine how to "echo" without newline: "echo -n" # or "echo ...\c" - if [ X`echo -n` = X-n ]; then + if [ X$(echo -n) = X-n ]; then ECHON=echo NNL="\c" # " @@ -46,8 +46,8 @@ die() { } init_tmpdir() { - local omask=`umask` - local __tmpd="/tmp/$PROGRAM-${$}-`date +%s`-$RANDOM" + local omask=$(umask) + local __tmpd="/tmp/$PROGRAM-${$}-$(date +%s)-$RANDOM" umask 077 || die "umask" mkdir -p "$__tmpd" || exit 1 trap "rm -fr \"$__tmpd\"; exit" 0 diff --git a/setup-acf.in b/setup-acf.in index c22a975..46e3529 100644 --- a/setup-acf.in +++ b/setup-acf.in @@ -23,14 +23,14 @@ while getopts "ae:hl:n" opt ; do *) usage;; esac done -shift `expr $OPTIND - 1` +shift $(expr $OPTIND - 1) while [ $# -gt 0 ]; do pkgs="$pkgs acf-$1" shift done -# install packages +# install packages apk add mini_httpd $pkgs || exit 1 if [ "$create_passwd" != "no" ]; then diff --git a/setup-alpine.in b/setup-alpine.in index 4aa5da3..efd6d4a 100644 --- a/setup-alpine.in +++ b/setup-alpine.in @@ -46,7 +46,7 @@ while getopts "af:c:hq" opt ; do *) usage;; esac done -shift `expr $OPTIND - 1` +shift $(expr $OPTIND - 1) rc_sys=$(openrc --sys) # mount xenfs so we can detect xen dom0 diff --git a/setup-apkrepos.in b/setup-apkrepos.in index 8c5e1e6..455dc20 100644 --- a/setup-apkrepos.in +++ b/setup-apkrepos.in @@ -176,12 +176,12 @@ fi MIRRORS_PATH=/usr/share/alpine-mirrors/MIRRORS.txt if [ -z "$MIRRORS" ] && [ -r "$MIRRORS_PATH" ]; then - MIRRORS=`cat $MIRRORS_PATH` + MIRRORS=$(cat $MIRRORS_PATH) fi APKREPOS_PATH="${ROOT}"etc/apk/repositories if [ -r "$APKREPOS_PATH" ]; then - APKREPOS=`cat "$APKREPOS_PATH"` + APKREPOS=$(cat "$APKREPOS_PATH") fi get_alpine_release diff --git a/setup-bootable.in b/setup-bootable.in index 205aa1b..b2c6796 100644 --- a/setup-bootable.in +++ b/setup-bootable.in @@ -215,7 +215,7 @@ fi srcdir= # Find the srcdir or srcurl. mount loopback if needed if [ -f "$src"/.alpine-release ]; then - srcdir="`echo $src | sed -r 's,/$,,'`" + srcdir="$(echo $src | sed -r 's,/$,,')" else case "$src" in http://*|ftp://*) srcurl="$src";; diff --git a/setup-dns.in b/setup-dns.in index 06568f6..18a6470 100644 --- a/setup-dns.in +++ b/setup-dns.in @@ -31,8 +31,8 @@ shift $(($OPTIND - 1)) conf="${ROOT}etc/resolv.conf" if [ -f "$conf" ] ; then - domain=`awk '/^domain/ {print $2}' $conf` - dns=`awk '/^nameserver/ {print $2}' $conf` + domain=$(awk '/^domain/ {print $2}' $conf) + dns=$(awk '/^nameserver/ {print $2}' $conf) fi if [ -n "$DOMAINNAME" ];then diff --git a/setup-hostname.in b/setup-hostname.in index 04420ac..a6aca77 100644 --- a/setup-hostname.in +++ b/setup-hostname.in @@ -57,7 +57,7 @@ fi HOST="$name" while [ -z "$name" ]; do - HOST=`hostname` + HOST=$(hostname) echon "Enter system hostname (short form, e.g. 'foo') [$HOST]: " default_read HOST "$HOST" if valid_hostname "$HOST"; then diff --git a/setup-interfaces.in b/setup-interfaces.in index a1ab283..e57c8ce 100644 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -190,7 +190,7 @@ config_iface() { done if [ "$resp" = "yes" ]; then - bridge="br"`echo $iface | sed 's/[^0-9]//g'` + bridge="br$(echo $iface | sed 's/[^0-9]//g')" ask "Name of the bridge you want add $iface to:" $bridge bridge_add_port $resp $iface return @@ -261,7 +261,7 @@ config_iface() { # use ipcalc -m to validate netmask. we dont accept /mask suffix # so we pass on a dummy mask to ipcalc. while ! ipcalc -s -m $netmask/0 >/dev/null 2>&1; do - netmask=`get_default_mask $address` + netmask=$(get_default_mask $address) ask "Netmask?" $netmask netmask=$resp [ "$netmask" = "abort" ] && return @@ -270,7 +270,7 @@ config_iface() { # use ipcalc -m to validate netmask. we dont accept /mask suffix # so we pass on a dummy mask to ipcalc. while ! ipcalc -s -m $gateway/0 >/dev/null 2>&1; do - gateway=`get_default_gateway $iface` + gateway=$(get_default_gateway $iface) [ -z "$gateway" ] && gateway=none ask "Gateway? (or 'none')" $gateway gateway=$resp @@ -480,7 +480,7 @@ prompt_for_interfaces() { hostname=$(cat $ROOT/etc/hostname 2>/dev/null) for i in *.conf ; do - iface=`basename $i .conf` + iface=$(basename $i .conf) iface=${iface#[0-9]*~} bridge_ports= bond_slaves= diff --git a/update-conf.in b/update-conf.in index 61ea654..4ee1a01 100644 --- a/update-conf.in +++ b/update-conf.in @@ -26,7 +26,7 @@ __EOF__ is_modified() { [ -f "$LBUCACHE" ] || lbu status -a | awk '{print $2}' > "$LBUCACHE" - test -n "`( echo \"$1\" ; cat \"$LBUCACHE\" ) | sort | uniq -d`" + test -n "$( ( echo \"$1\" ; cat \"$LBUCACHE\" ) | sort | uniq -d)" } @@ -34,7 +34,7 @@ is_initd() { echo "$1" | grep etc/init.d/ > /dev/null } -args=`getopt -o ailh --long all,initd,list,help -n "$PROGRAM" -- "$@"` +args=$(getopt -o ailh --long all,initd,list,help -n "$PROGRAM" -- "$@") if [ $? -ne 0 ]; then usage exit 2 -- cgit v1.2.3