Skip to content

Commit

Permalink
Use $() rather than backticks in all shell
Browse files Browse the repository at this point in the history
The cool kids are all using $() these days as backticks are all
backwards and uncool.

Practically speaking, it makes it easier to escape things, nest things,
and all the other reasons listed on http://mywiki.wooledge.org/BashFAQ/082

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
stewartsmith committed Sep 13, 2018
1 parent 9ff660e commit 084e37b
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion libstb/sign-with-local-keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi
KEYLOC=$3
LABEL=$4

T=`mktemp -d`
T=$(mktemp -d)
LABEL_ARG=""
if [ ! -z "$LABEL" ]; then
LABEL_ARG="-L $LABEL"
Expand Down
2 changes: 1 addition & 1 deletion make_offsets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ cat <<EOF
#define ASM_OFFSETS_H
/* Derived from $1 by make_offsets.sh */
`grep '#define' $1`
$(grep '#define' $1)
#endif /* ASM_OFFSETS_H */
EOF
12 changes: 6 additions & 6 deletions make_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ fi

if test -e .git || git rev-parse --is-inside-work-tree > /dev/null 2>&1;
then
version=`git describe --exact-match 2>/dev/null`
version=$(git describe --exact-match 2>/dev/null)
if [ -z "$version" ];
then
version=`git describe 2>/dev/null`
version=$(git describe 2>/dev/null)
fi
if [ -z "$version" ];
then
version=`git rev-parse --verify --short HEAD 2>/dev/null`
version=$(git rev-parse --verify --short HEAD 2>/dev/null)
fi
if [ ! -z "$EXTRA_VERSION" ];
then
Expand All @@ -34,14 +34,14 @@ then
version="$version-$USER"
fi
version="$version-dirty"
diffsha=`git diff|sha1sum`
diffsha=`cut -c-7 <<< "$diffsha"`
diffsha=$(git diff|sha1sum)
diffsha=$(cut -c-7 <<< "$diffsha")
version="$version-$diffsha"
fi

if [ $# -eq 1 ];
then
version=`echo $version | sed s/skiboot/$1/`
version=$(echo $version | sed s/skiboot/$1/)
fi

echo $version
Expand Down
8 changes: 4 additions & 4 deletions opal-ci/build-centos7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ set -vx
# We're limited as to what we want to bother to run on CentOS7
# It's fairly old and some of the things (e.g. build+run qemu) we don't
# want to bother doing.
if [ `arch` == "x86_64" ]; then
if [ $(arch) == "x86_64" ]; then
export CROSS=/opt/cross/gcc-4.8.0-nolibc/powerpc64-linux/bin/powerpc64-linux-
fi
# Note that this doesn't work on centos7 because "/lib64/ld64.so.2: version `GLIBC_2.22' not found"
if [ `arch` == "ppc64le" ]; then
if [ $(arch) == "ppc64le" ]; then
export CROSS=/opt/cross/gcc-4.9.4-nolibc/powerpc64-linux/bin/powerpc64-linux-
fi

MAKE_J=`grep -c processor /proc/cpuinfo`
MAKE_J=$(grep -c processor /proc/cpuinfo)

make -j${MAKE_J} all
make -j${MAKE_J} check
Expand All @@ -28,5 +28,5 @@ SKIBOOT_GCOV=1 make -j${MAKE_J} check
make clean
rm -rf builddir
mkdir builddir
make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
make SRC=$(pwd) -f ../Makefile -C builddir -j${MAKE_J}
make clean
4 changes: 2 additions & 2 deletions opal-ci/build-fedora27.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -uo pipefail
set -e
set -vx

MAKE_J=`grep -c processor /proc/cpuinfo`
MAKE_J=$(grep -c processor /proc/cpuinfo)
export CROSS="ccache powerpc64-linux-gnu-"

make -j${MAKE_J} all
Expand All @@ -21,5 +21,5 @@ make clean
make clean
rm -rf builddir
mkdir builddir
make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
make SRC=$(pwd) -f ../Makefile -C builddir -j${MAKE_J}
make clean
2 changes: 1 addition & 1 deletion opal-ci/build-qemu-powernv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ git submodule update --init dtc
export CC="ccache gcc"
export CXX="ccache g++"
./configure --target-list=ppc64-softmmu --disable-werror
make -j `grep -c processor /proc/cpuinfo`
make -j $(grep -c processor /proc/cpuinfo)
6 changes: 3 additions & 3 deletions opal-ci/build-ubuntu-16.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ set -uo pipefail
set -e
set -vx

MAKE_J=`grep -c processor /proc/cpuinfo`
MAKE_J=$(grep -c processor /proc/cpuinfo)

export CROSS="ccache powerpc64le-linux-gnu-"

make -j${MAKE_J} all
(cd opal-ci; ./build-qemu-powernv.sh)
export QEMU_BIN=`pwd`/opal-ci/qemu/ppc64-softmmu/qemu-system-ppc64
export QEMU_BIN=$(pwd)/opal-ci/qemu/ppc64-softmmu/qemu-system-ppc64
./opal-ci/fetch-debian-jessie-installer.sh
make -j${MAKE_J} check
(make clean; cd external/gard && CROSS= make -j${MAKE_J})
Expand All @@ -30,5 +30,5 @@ SKIBOOT_GCOV=1 make -j${MAKE_J} check
make clean
rm -rf builddir
mkdir builddir
make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
make SRC=$(pwd) -f ../Makefile -C builddir -j${MAKE_J}
make clean
4 changes: 2 additions & 2 deletions opal-ci/build-ubuntu-18.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -uo pipefail
set -e
set -vx

MAKE_J=`grep -c processor /proc/cpuinfo`
MAKE_J=$(grep -c processor /proc/cpuinfo)

export CROSS="ccache powerpc64le-linux-gnu-"

Expand All @@ -28,7 +28,7 @@ SKIBOOT_GCOV=1 make -j${MAKE_J} check
make clean
rm -rf builddir
mkdir builddir
make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
make SRC=$(pwd) -f ../Makefile -C builddir -j${MAKE_J}
make clean

echo "Building with clang..."
Expand Down
8 changes: 4 additions & 4 deletions test/hello_world/run_mambo_hello_world.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping hello_world test';
exit 0;
fi

if [ -n "$SKIBOOT_ENABLE_MAMBO_STB" ]; then
export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel.stb
export SKIBOOT_ZIMAGE=$(pwd)/test/hello_world/hello_kernel/hello_kernel.stb
else
export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel
export SKIBOOT_ZIMAGE=$(pwd)/test/hello_world/hello_kernel/hello_kernel
fi

# Currently getting some core dumps from mambo, so disable them!
OLD_ULIMIT_C=`ulimit -c`
OLD_ULIMIT_C=$(ulimit -c)
ulimit -c 0

t=$(mktemp) || exit 1
Expand Down
8 changes: 4 additions & 4 deletions test/hello_world/run_mambo_p9_hello_world.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping hello_world test';
exit 0;
fi

if [ -n "$SKIBOOT_ENABLE_MAMBO_STB" ]; then
export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel.stb
export SKIBOOT_ZIMAGE=$(pwd)/test/hello_world/hello_kernel/hello_kernel.stb
else
export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel
export SKIBOOT_ZIMAGE=$(pwd)/test/hello_world/hello_kernel/hello_kernel
fi

# Currently getting some core dumps from mambo, so disable them!
OLD_ULIMIT_C=`ulimit -c`
OLD_ULIMIT_C=$(ulimit -c)
ulimit -c 0

t=$(mktemp) || exit 1
Expand Down
6 changes: 3 additions & 3 deletions test/hello_world/run_qemu_hello_world.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -z "$QEMU_BIN" ]; then
QEMU_BIN="qemu-system-ppc64"
fi

if [ ! `command -v $QEMU_BIN` ]; then
if [ ! $(command -v $QEMU_BIN) ]; then
echo "Could not find executable QEMU_BIN ($QEMU_BIN). Skipping hello_world test";
exit 0;
fi
Expand All @@ -15,13 +15,13 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping hello_world test';
exit 0;
fi


export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel
export SKIBOOT_ZIMAGE=$(pwd)/test/hello_world/hello_kernel/hello_kernel

t=$(mktemp) || exit 1

Expand Down
2 changes: 1 addition & 1 deletion test/make-boot-coverage-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# We cheat and do this in a shell script so I don't go Makefile crazy.

SKIBOOT_GCOV_ADDR=`perl -e "printf '0x%x', 0x30000000 + 0x\`grep gcov_info_list skiboot.map|cut -f 1 -d ' '\`"`
SKIBOOT_GCOV_ADDR=$(perl -e "printf '0x%x', 0x30000000 + 0x$(grep gcov_info_list skiboot.map|cut -f 1 -d ' ')")

LCOV_INFO_FILES=""

Expand Down
6 changes: 3 additions & 3 deletions test/run_mambo_boot_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping hello_world test';
exit 0;
fi

if [ -z "$SKIBOOT_ZIMAGE" ]; then
export SKIBOOT_ZIMAGE=`pwd`/zImage.epapr
export SKIBOOT_ZIMAGE=$(pwd)/zImage.epapr
fi

if [ ! -f "$SKIBOOT_ZIMAGE" ]; then
Expand All @@ -38,7 +38,7 @@ if [ -z "$SKIBOOT_MEM_DUMP" ]; then
fi

# Currently getting some core dumps from mambo, so disable them!
OLD_ULIMIT_C=`ulimit -c`
OLD_ULIMIT_C=$(ulimit -c)
ulimit -c 0

t=$(mktemp) || exit 1
Expand Down
8 changes: 4 additions & 4 deletions test/run_qemu-jessie-debian-installer_boot_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -z "$QEMU_BIN" ]; then
QEMU_BIN="qemu-system-ppc64"
fi

if [ ! `command -v $QEMU_BIN` ]; then
if [ ! $(command -v $QEMU_BIN) ]; then
echo "Could not find executable QEMU_BIN ($QEMU_BIN). Skipping hello_world test";
exit 0;
fi
Expand All @@ -15,7 +15,7 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping boot test';
exit 0;
fi
Expand All @@ -30,8 +30,8 @@ if [ ! -f debian-jessie-initrd.gz ]; then
exit 0;
fi

T=`mktemp --tmpdir skiboot_qemu_debian-jessie-boot_test.XXXXXXXXXX`
#D=`mktemp --tmpdir debian-jessie-install.qcow2.XXXXXXXXXX`
T=$(mktemp --tmpdir skiboot_qemu_debian-jessie-boot_test.XXXXXXXXXX)
#D=$(mktemp --tmpdir debian-jessie-install.qcow2.XXXXXXXXXX)

# In future we should do full install:
# FIXME: -append "DEBIAN_FRONTEND=text locale=en_US keymap=us hostname=OPALtest domain=unassigned-domain rescue/enable=true"
Expand Down
8 changes: 4 additions & 4 deletions test/run_qemu_boot_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -z "$QEMU_BIN" ]; then
QEMU_BIN="qemu-system-ppc64"
fi

if [ ! `command -v $QEMU_BIN` ]; then
if [ ! $(command -v $QEMU_BIN) ]; then
echo "Could not find executable QEMU_BIN ($QEMU_BIN). Skipping hello_world test";
exit 0;
fi
Expand All @@ -15,21 +15,21 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping hello_world test';
exit 0;
fi

if [ -z "$SKIBOOT_ZIMAGE" ]; then
export SKIBOOT_ZIMAGE=`pwd`/zImage.epapr
export SKIBOOT_ZIMAGE=$(pwd)/zImage.epapr
fi

if [ ! -f "$SKIBOOT_ZIMAGE" ]; then
echo "No $SKIBOOT_ZIMAGE, skipping boot test";
exit 0;
fi

T=`mktemp --tmpdir skiboot_qemu_boot_test.XXXXXXXXXX`
T=$(mktemp --tmpdir skiboot_qemu_boot_test.XXXXXXXXXX)

( cat <<EOF | expect
set timeout 600
Expand Down
8 changes: 4 additions & 4 deletions test/sreset_world/run_mambo_p9_sreset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping sreset_world test';
exit 0;
fi

if [ -n "$SKIBOOT_ENABLE_MAMBO_STB" ]; then
export SKIBOOT_ZIMAGE=`pwd`/test/sreset_world/sreset_kernel/sreset_kernel.stb
export SKIBOOT_ZIMAGE=$(pwd)/test/sreset_world/sreset_kernel/sreset_kernel.stb
else
export SKIBOOT_ZIMAGE=`pwd`/test/sreset_world/sreset_kernel/sreset_kernel
export SKIBOOT_ZIMAGE=$(pwd)/test/sreset_world/sreset_kernel/sreset_kernel
fi

# Currently getting some core dumps from mambo, so disable them!
OLD_ULIMIT_C=`ulimit -c`
OLD_ULIMIT_C=$(ulimit -c)
ulimit -c 0

t=$(mktemp) || exit 1
Expand Down
8 changes: 4 additions & 4 deletions test/sreset_world/run_mambo_sreset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ if [ -n "$KERNEL" ]; then
exit 0;
fi

if [ ! `command -v expect` ]; then
if [ ! $(command -v expect) ]; then
echo 'Could not find expect binary. Skipping sreset_world test';
exit 0;
fi

if [ -n "$SKIBOOT_ENABLE_MAMBO_STB" ]; then
export SKIBOOT_ZIMAGE=`pwd`/test/sreset_world/sreset_kernel/sreset_kernel.stb
export SKIBOOT_ZIMAGE=$(pwd)/test/sreset_world/sreset_kernel/sreset_kernel.stb
else
export SKIBOOT_ZIMAGE=`pwd`/test/sreset_world/sreset_kernel/sreset_kernel
export SKIBOOT_ZIMAGE=$(pwd)/test/sreset_world/sreset_kernel/sreset_kernel
fi

# Currently getting some core dumps from mambo, so disable them!
OLD_ULIMIT_C=`ulimit -c`
OLD_ULIMIT_C=$(ulimit -c)
ulimit -c 0

t=$(mktemp) || exit 1
Expand Down

0 comments on commit 084e37b

Please sign in to comment.