Skip to content
This repository was archived by the owner on Sep 19, 2021. It is now read-only.

Commit ca95d6d

Browse files
theycallmemacvaage
authored andcommitted
Corrected Variable Expansion To Meet Style Guide Requirements (#86)
The original run scripts did not follow the style guide for variable expansion as dictated here (https://google.github.io/styleguide/shell.xml?showone=Variable_expansion#Variable_expansion). Variables in the bash scripts should be bracket-quoted per shell style guide. Closes #11
1 parent 98e7d23 commit ca95d6d

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

run_client.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
HOST="$1"
1818
PORT="$2"
1919

20-
if [[ "$HOST" == "" || "$PORT" == "" ]] ; then
20+
if [[ "${HOST}" == "" || "${PORT}" == "" ]] ; then
2121
echo 'usage: <HOST> <PORT>'
2222
exit 1
2323
fi
2424

2525
cd './bin'
26-
java codeu.chat.ClientMain "$HOST@$PORT"
26+
java codeu.chat.ClientMain "${HOST}@${PORT}"

run_relay.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
PORT="$1"
1818
TEAM_FILE="$2"
1919

20-
if [[ "$PORT" == "" || "$TEAM_FILE" == "" ]] ; then
20+
if [[ "${PORT}" == "" || "${TEAM_FILE}" == "" ]] ; then
2121
echo 'usage: <PORT> <TEAM FILE>'
2222
exit 1
2323
fi
2424

25-
if [ ! -f "$TEAM_FILE" ] ; then
26-
echo "No file at $TEAM_FILE"
25+
if [ ! -f "${TEAM_FILE}" ] ; then
26+
echo "No file at ${TEAM_FILE}"
2727
exit 1
2828
fi
2929

3030
cd './bin'
31-
java codeu.chat.RelayMain "$PORT" "$TEAM_FILE"
31+
java codeu.chat.RelayMain "${PORT}" "${TEAM_FILE}"

run_server.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PORT="$3"
2020
PERSISTENT_DIR="$4"
2121
RELAY_ADDRESS="$5"
2222

23-
if [[ "$TEAM_ID" == "" || "$TEAM_SECRET" == "" || "$PORT" == "" || "$PERSISTENT_DIR" == "" ]] ; then
23+
if [[ "${TEAM_ID}" == "" || "${TEAM_SECRET}" == "" || "${PORT}" == "" || "${PERSISTENT_DIR}" == "" ]] ; then
2424
echo 'usage: <TEAM ID> <TEAM SECRET> <PORT> <PERSISTENT> [RELAY ADDRESS]'
2525
echo ''
2626
echo 'TEAM ID : The id registered with the relay server. If you are'
@@ -41,17 +41,17 @@ fi
4141

4242

4343
cd './bin'
44-
if [ "$RELAY_ADDRESS" == "" ] ; then
44+
if [ "${RELAY_ADDRESS}" == "" ] ; then
4545
java codeu.chat.ServerMain \
46-
"$TEAM_ID" \
47-
"$TEAM_SECRET" \
48-
"$PORT" \
49-
"$PERSISTENT_DIR"
46+
"${TEAM_ID}" \
47+
"${TEAM_SECRET}" \
48+
"${PORT}" \
49+
"${PERSISTENT_DIR}"
5050
else
5151
java codeu.chat.ServerMain \
52-
"$TEAM_ID" \
53-
"$TEAM_SECRET" \
54-
"$PORT" \
55-
"$PERSISTENT_DIR" \
56-
"$RELAY_ADDRESS"
52+
"${TEAM_ID}" \
53+
"${TEAM_SECRET}" \
54+
"${PORT}" \
55+
"${PERSISTENT_DIR}" \
56+
"${RELAY_ADDRESS}"
5757
fi

run_simple_gui_client.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ LOCAL_MACHINE="localhost@2007"
1818

1919
cd './bin'
2020

21-
java codeu.chat.SimpleGuiClientMain "$LOCAL_MACHINE"
21+
java codeu.chat.SimpleGuiClientMain "${LOCAL_MACHINE}"

0 commit comments

Comments
 (0)