Run several commands with sudo
suggest changesudo -s <<EOF
a='var'
echo 'Running serveral commands with sudo'
mktemp -d
echo "\$a"
EOF
$a
needs to be escaped to prevent it to be expanded by the current shell
Or
sudo -s <<'EOF'
a='var'
echo 'Running serveral commands with sudo'
mktemp -d
echo "$a"
EOF
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents