Commit 07c02f67 authored by Jakub Jirutka's avatar Jakub Jirutka

replace deprecated `...` syntax with $(...) in shell scripts

parent cb474e20
...@@ -723,8 +723,8 @@ cmd_migrate_include_exclude() { ...@@ -723,8 +723,8 @@ cmd_migrate_include_exclude() {
#----------------------------------------------------------- #-----------------------------------------------------------
# Main # Main
cmd=`echo "$PROGRAM" | cut -s -d_ -f2` cmd=$(echo "$PROGRAM" | cut -s -d_ -f2)
PROGRAM=`echo "$PROGRAM" | cut -d_ -f1` PROGRAM=$(echo "$PROGRAM" | cut -d_ -f1)
if [ -z "$cmd" ] ; then if [ -z "$cmd" ] ; then
cmd="$1" cmd="$1"
[ -z "$cmd" ] && usage [ -z "$cmd" ] && usage
...@@ -773,7 +773,7 @@ while getopts "adehlM:np:qrv" opt ; do ...@@ -773,7 +773,7 @@ while getopts "adehlM:np:qrv" opt ; do
;; ;;
esac esac
done done
shift `expr $OPTIND - 1` shift $(expr $OPTIND - 1)
trap exit_clean SIGINT SIGTERM trap exit_clean SIGINT SIGTERM
cmd_$SUBCMD "$@" cmd_$SUBCMD "$@"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
PREFIX=@PREFIX@ PREFIX=@PREFIX@
PROGRAM=`basename $0` PROGRAM=$(basename $0)
: ${ROOT:=/} : ${ROOT:=/}
[ "${ROOT}" = "${ROOT%/}" ] && ROOT="${ROOT}/" [ "${ROOT}" = "${ROOT%/}" ] && ROOT="${ROOT}/"
...@@ -12,7 +12,7 @@ echon () { ...@@ -12,7 +12,7 @@ echon () {
if [ X"$ECHON" = X ]; then if [ X"$ECHON" = X ]; then
# Determine how to "echo" without newline: "echo -n" # Determine how to "echo" without newline: "echo -n"
# or "echo ...\c" # or "echo ...\c"
if [ X`echo -n` = X-n ]; then if [ X$(echo -n) = X-n ]; then
ECHON=echo ECHON=echo
NNL="\c" NNL="\c"
# " # "
...@@ -46,8 +46,8 @@ die() { ...@@ -46,8 +46,8 @@ die() {
} }
init_tmpdir() { init_tmpdir() {
local omask=`umask` local omask=$(umask)
local __tmpd="/tmp/$PROGRAM-${$}-`date +%s`-$RANDOM" local __tmpd="/tmp/$PROGRAM-${$}-$(date +%s)-$RANDOM"
umask 077 || die "umask" umask 077 || die "umask"
mkdir -p "$__tmpd" || exit 1 mkdir -p "$__tmpd" || exit 1
trap "rm -fr \"$__tmpd\"; exit" 0 trap "rm -fr \"$__tmpd\"; exit" 0
......
...@@ -23,14 +23,14 @@ while getopts "ae:hl:n" opt ; do ...@@ -23,14 +23,14 @@ while getopts "ae:hl:n" opt ; do
*) usage;; *) usage;;
esac esac
done done
shift `expr $OPTIND - 1` shift $(expr $OPTIND - 1)
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
pkgs="$pkgs acf-$1" pkgs="$pkgs acf-$1"
shift shift
done done
# install packages # install packages
apk add mini_httpd $pkgs || exit 1 apk add mini_httpd $pkgs || exit 1
if [ "$create_passwd" != "no" ]; then if [ "$create_passwd" != "no" ]; then
......
...@@ -46,7 +46,7 @@ while getopts "af:c:hq" opt ; do ...@@ -46,7 +46,7 @@ while getopts "af:c:hq" opt ; do
*) usage;; *) usage;;
esac esac
done done
shift `expr $OPTIND - 1` shift $(expr $OPTIND - 1)
rc_sys=$(openrc --sys) rc_sys=$(openrc --sys)
# mount xenfs so we can detect xen dom0 # mount xenfs so we can detect xen dom0
......
...@@ -176,12 +176,12 @@ fi ...@@ -176,12 +176,12 @@ fi
MIRRORS_PATH=/usr/share/alpine-mirrors/MIRRORS.txt MIRRORS_PATH=/usr/share/alpine-mirrors/MIRRORS.txt
if [ -z "$MIRRORS" ] && [ -r "$MIRRORS_PATH" ]; then if [ -z "$MIRRORS" ] && [ -r "$MIRRORS_PATH" ]; then
MIRRORS=`cat $MIRRORS_PATH` MIRRORS=$(cat $MIRRORS_PATH)
fi fi
APKREPOS_PATH="${ROOT}"etc/apk/repositories APKREPOS_PATH="${ROOT}"etc/apk/repositories
if [ -r "$APKREPOS_PATH" ]; then if [ -r "$APKREPOS_PATH" ]; then
APKREPOS=`cat "$APKREPOS_PATH"` APKREPOS=$(cat "$APKREPOS_PATH")
fi fi
get_alpine_release get_alpine_release
......
...@@ -215,7 +215,7 @@ fi ...@@ -215,7 +215,7 @@ fi
srcdir= srcdir=
# Find the srcdir or srcurl. mount loopback if needed # Find the srcdir or srcurl. mount loopback if needed
if [ -f "$src"/.alpine-release ]; then if [ -f "$src"/.alpine-release ]; then
srcdir="`echo $src | sed -r 's,/$,,'`" srcdir="$(echo $src | sed -r 's,/$,,')"
else else
case "$src" in case "$src" in
http://*|ftp://*) srcurl="$src";; http://*|ftp://*) srcurl="$src";;
......
...@@ -31,8 +31,8 @@ shift $(($OPTIND - 1)) ...@@ -31,8 +31,8 @@ shift $(($OPTIND - 1))
conf="${ROOT}etc/resolv.conf" conf="${ROOT}etc/resolv.conf"
if [ -f "$conf" ] ; then if [ -f "$conf" ] ; then
domain=`awk '/^domain/ {print $2}' $conf` domain=$(awk '/^domain/ {print $2}' $conf)
dns=`awk '/^nameserver/ {print $2}' $conf` dns=$(awk '/^nameserver/ {print $2}' $conf)
fi fi
if [ -n "$DOMAINNAME" ];then if [ -n "$DOMAINNAME" ];then
......
...@@ -57,7 +57,7 @@ fi ...@@ -57,7 +57,7 @@ fi
HOST="$name" HOST="$name"
while [ -z "$name" ]; do while [ -z "$name" ]; do
HOST=`hostname` HOST=$(hostname)
echon "Enter system hostname (short form, e.g. 'foo') [$HOST]: " echon "Enter system hostname (short form, e.g. 'foo') [$HOST]: "
default_read HOST "$HOST" default_read HOST "$HOST"
if valid_hostname "$HOST"; then if valid_hostname "$HOST"; then
......
...@@ -190,7 +190,7 @@ config_iface() { ...@@ -190,7 +190,7 @@ config_iface() {
done done
if [ "$resp" = "yes" ]; then 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 ask "Name of the bridge you want add $iface to:" $bridge
bridge_add_port $resp $iface bridge_add_port $resp $iface
return return
...@@ -261,7 +261,7 @@ config_iface() { ...@@ -261,7 +261,7 @@ config_iface() {
# use ipcalc -m to validate netmask. we dont accept <addr>/mask suffix # use ipcalc -m to validate netmask. we dont accept <addr>/mask suffix
# so we pass on a dummy mask to ipcalc. # so we pass on a dummy mask to ipcalc.
while ! ipcalc -s -m $netmask/0 >/dev/null 2>&1; do while ! ipcalc -s -m $netmask/0 >/dev/null 2>&1; do
netmask=`get_default_mask $address` netmask=$(get_default_mask $address)
ask "Netmask?" $netmask ask "Netmask?" $netmask
netmask=$resp netmask=$resp
[ "$netmask" = "abort" ] && return [ "$netmask" = "abort" ] && return
...@@ -270,7 +270,7 @@ config_iface() { ...@@ -270,7 +270,7 @@ config_iface() {
# use ipcalc -m to validate netmask. we dont accept <addr>/mask suffix # use ipcalc -m to validate netmask. we dont accept <addr>/mask suffix
# so we pass on a dummy mask to ipcalc. # so we pass on a dummy mask to ipcalc.
while ! ipcalc -s -m $gateway/0 >/dev/null 2>&1; do 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 [ -z "$gateway" ] && gateway=none
ask "Gateway? (or 'none')" $gateway ask "Gateway? (or 'none')" $gateway
gateway=$resp gateway=$resp
...@@ -480,7 +480,7 @@ prompt_for_interfaces() { ...@@ -480,7 +480,7 @@ prompt_for_interfaces() {
hostname=$(cat $ROOT/etc/hostname 2>/dev/null) hostname=$(cat $ROOT/etc/hostname 2>/dev/null)
for i in *.conf ; do for i in *.conf ; do
iface=`basename $i .conf` iface=$(basename $i .conf)
iface=${iface#[0-9]*~} iface=${iface#[0-9]*~}
bridge_ports= bridge_ports=
bond_slaves= bond_slaves=
......
...@@ -26,7 +26,7 @@ __EOF__ ...@@ -26,7 +26,7 @@ __EOF__
is_modified() { is_modified() {
[ -f "$LBUCACHE" ] || lbu status -a | awk '{print $2}' > "$LBUCACHE" [ -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() { ...@@ -34,7 +34,7 @@ is_initd() {
echo "$1" | grep etc/init.d/ > /dev/null 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 if [ $? -ne 0 ]; then
usage usage
exit 2 exit 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment