diff --git a/lib/core.sh b/lib/core.sh index 8580c1e..eb89283 100644 --- a/lib/core.sh +++ b/lib/core.sh @@ -190,7 +190,7 @@ function _run_juju_with_proot(){ if [ "$1" != "" ] then - _run_proot "${proot_args}" "${@}" + insert_quotes "${@}" | _run_proot "${proot_args}" "${SH[@]}" else _run_proot "${proot_args}" "${SH[@]}" fi diff --git a/lib/util.sh b/lib/util.sh index 9f411a3..0322138 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -67,3 +67,14 @@ function ask(){ fi } + +function insert_quotes(){ +# It inserts quotes between arguments. +# Useful to preserve quotes on command +# to be used inside sh -c/bash -c + C='' + for i in "$@"; do + C="$C \"${i//\"/\\\"}\"" + done + echo ${C} +}