properly escape single quotes

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2016-05-25 12:39:11 +02:00
parent aea9747918
commit 4547d2efa1
1 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,10 @@ target_host="$__target_host"
shift
ssh="ssh -o User=root -q $target_host"
code="$ssh chroot $chroot sh -c '$@'"
# escape ' with '"'"'
code="$(echo "$@" | sed -e "s/'/'\"'\"'/g")"
code="$ssh chroot $chroot sh -c '$code'"
log "target_host: $target_host"
log "chroot: $chroot"