Skip to content

Commit 1f04771

Browse files
committed
support quoted arguments
Signed-off-by: Evangelos Lamprou <vagos@lamprou.xyz>
1 parent e676e83 commit 1f04771

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

try

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,13 @@ cd "$START_DIR" &&
293293
OLDPWD=$OLDPWD . "$script_to_execute"
294294
EOF
295295

296-
echo "$@" >"$script_to_execute"
296+
{
297+
printf '#!/bin/sh\nexec'
298+
for arg in "$@"; do
299+
printf ' %s' "'$(printf %s "$arg" | sed "s/'/'\"'\"'/g")'"
300+
done
301+
printf '\n'
302+
} >"$script_to_execute"
297303

298304
# `$script_to_execute` need not be +x to be sourced
299305
chmod +x "$mount_and_execute" "$chroot_executable"

0 commit comments

Comments
 (0)