Skip to content

Commit 0289bb8

Browse files
author
Joe Schaefer
committed
old-bash-support
- echo -e - requires more newline escapes
1 parent 6da560b commit 0289bb8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kubectl-node_shell

100755100644
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,16 @@ if [ $# -gt 0 ]; then
7474
else
7575
cmd+=(bash -l)
7676
fi
77-
# translate embedded single-quotes to double-quotes, so the following line will work
78-
cmd=( "${cmd[@]//\'/\"}" )
77+
78+
# translate embedded single-quotes to double-quotes, and double backslashes,
79+
# so the following jsonify (sed) line will work
80+
cmd=( "${cmd[@]//\'/\"}" )
81+
cmd=( "${cmd[@]//\\/\\\\/}" )
7982

8083
# jsonify(as an array) the argument list (mainly from the command line)
81-
entrypoint="$(echo "['${cmd[@]/%/\', \'}']" | sed -e "s/' /'/g" \
82-
-e "s/, '']\$/]/" -Ee "s/([\"\\])/\\\\\1/g" -e 's/\\\\n/\\n/g' | tr \' \")"
84+
85+
entrypoint="$(echo -e "['${cmd[@]/%/\', \'}']" | sed -e "s/' /'/g" \
86+
-e "s/, '']\$/]/" -Ee 's/(["\\])/\\\1/g' -e 's/\\\\n/\\n/g' | tr \' \")"
8387

8488
if [ -z "$node" ]; then
8589
echo "Please specify node name"

0 commit comments

Comments
 (0)