Skip to content

Instantly share code, notes, and snippets.

@g3rhard
Created August 24, 2022 09:45
Show Gist options
  • Save g3rhard/e76e16dda003ab2eec4feebc18533409 to your computer and use it in GitHub Desktop.
Save g3rhard/e76e16dda003ab2eec4feebc18533409 to your computer and use it in GitHub Desktop.
#!/bin/bash
# https://github.com/ansible/ansible/issues/12686#issuecomment-268535162
cmd=''
for i in "$@"; do
i="${i//\\/\\\\}"
cmd="$cmd \"${i//\"/\\\"}\""
done
sudo su - root << END
$cmd
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment