From 789dcf76b65405714d3b6e306d75edf59348ad6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Fri, 22 Mar 2019 19:58:51 -0700 Subject: net-test: rootfs/net_test.sh - minor stylistic fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Google shell style guide: https://google.github.io/styleguide/shell.xml says to always use "${x}" instead of $x, and in general to double quote everything (fixes issues with whitespace in variable expansions). Similarly [[ is bash builtin, unlike [ or test. Bug: 126465735 Signed-off-by: Maciej Żenczykowski Change-Id: I507ceb630e7dd7347783e499826dcce2c2c50ee5 --- net/test/rootfs/net_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/test/rootfs/net_test.sh b/net/test/rootfs/net_test.sh index b4f1f4db..34f4a010 100755 --- a/net/test/rootfs/net_test.sh +++ b/net/test/rootfs/net_test.sh @@ -25,13 +25,13 @@ mount -t tmpfs tmpfs /run # If this system was booted under UML, it will always have a /proc/exitcode # file. If it was booted natively or under QEMU, it will not have this file. -if [ -e /proc/exitcode ]; then +if [[ -e /proc/exitcode ]]; then mount -t hostfs hostfs /host else mount -t 9p -o trans=virtio,version=9p2000.L host /host fi -test=$(cat /proc/cmdline | sed -re 's/.*net_test=([^ ]*).*/\1/g') -cd $(dirname $test) +test="$(sed -r 's/.*net_test=([^ ]*).*/\1/g' < /proc/cmdline)" +cd "$(dirname "${test}")" ./net_test.sh poweroff -f -- cgit v1.2.3