Skip to content

Commit 659dda1

Browse files
author
David Personette
committed
torproxy.sh fix quotations for variables
1 parent f464c76 commit 659dda1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tor-route-all-traffic.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ set -euo pipefail # Treat unset variables as an error
2626
_non_tor="192.168.1.0/24 192.168.0.0/24"
2727

2828
### get the container tor runs in
29-
_tor_container=$(docker ps | awk '/torproxy/ {print $NF; quit}')
29+
_tor_container="$(docker ps | awk '/torproxy/ {print $NF; quit}')"
3030
if [[ "$_tor_container" == "" ]]; then
3131
echo 'ERROR: you must start a tor proxy container first, IE:'
3232
echo ' docker run -d --net host --restart always dperson/torproxy'
3333
exit 1
3434
fi
3535

3636
### get the UID that tor runs as
37-
_tor_uid=$(docker exec $_tor_container id -u tor)
37+
_tor_uid="$(docker exec $_tor_container id -u tor)"
3838

3939
### Tor's TransPort
4040
_trans_port="9040"

torproxy.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ password() { local passwd="$1" file=/etc/tor/torrc
7373
# Arguments:
7474
# none)
7575
# Return: Help text
76-
usage() { local RC=${1:-0}
76+
usage() { local RC="${1:-0}"
7777
echo "Usage: ${0##*/} [-opt] [command]
7878
Options (fields in '[]' are optional, '<>' are required):
7979
-h This help
@@ -117,10 +117,10 @@ shift $(( OPTIND - 1 ))
117117
[[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o tor
118118
[[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o tor
119119
for env in $(printenv | grep '^TOR_'); do
120-
name=$(cut -c4- <<< ${env%%=*})
120+
name="$(cut -c4- <<< ${env%%=*})"
121121
val="\"${env##*=}\""
122122
[[ "$name" =~ _ ]] && continue
123-
[[ "$val" =~ ^\"([0-9]+|false|true)\"$ ]] && val=$(sed 's|"||g' <<<$val)
123+
[[ "$val" =~ ^\"([0-9]+|false|true)\"$ ]] && val="$(sed 's|"||g' <<< $val)"
124124
if grep -q "^$name" /etc/tor/torrc; then
125125
sed -i "/^$name/s| .*| $val|" /etc/tor/torrc
126126
else

0 commit comments

Comments
 (0)