Skip to content

Commit ed87423

Browse files
author
Joe Schaefer
committed
perl-for-cntrl-chars
1 parent cdacecc commit ed87423

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kubectl-node_shell

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node=""
88
nodefaultctx=0
99
nodefaultns=0
1010
cmd='[ "nsenter", "--target", "1", "--mount", "--uts", "--ipc", "--net", "--pid", "--"'
11-
if ! [ -p /dev/stdin ] && ! [ -p /dev/stdout ]; then
11+
if [ -t 0 ]; then
1212
tty=true
1313
else
1414
tty=false
@@ -75,7 +75,7 @@ done
7575
if [ $# -gt 0 ]; then
7676
while [ $# -gt 0 ]; do
7777
cmd="$cmd, \"$(echo "$1" | \
78-
awk '{gsub(/\\/,"\\\\");gsub(/"/,"\\\"");gsub(/$/,"\\n");printf last}{last=$0} END{gsub(/\\n/,"",last);printf last}' \
78+
perl -pl -0777 -e 's/([\\"])/\\$1/g;s/\n$//;s/\n/\\n/g;s/([\x01-\x1f])/sprintf "\\u%04x",ord $1/ge' \
7979
)\""
8080
shift
8181
done

0 commit comments

Comments
 (0)