In bash I can create a script with a here-doc like so as per this site: http://tldp.org/LDP/abs/html/abs-guide.html#GENERATESCRIPT
(
cat <<'EOF'
#!/bin/bash
#? [ ] / \ = + < > : ; " , * |
#/ ? < > \ : * | ”
#Filename="z:"${$winFn//\//\\}
echo "This is a generated shell script."
App='eval wine "C:\Program Files\foxit\Foxit Reader.exe" "'$winFn'"'
$App
EOF
) > $OUTFILE
If my $OUTFILE
is a directory requiring sudo
privileges where do I put the sudo
command or what else can I do to make it work?
This is how I would do it:
sudo tee "$OUTFILE" > /dev/null <<'EOF'
foo
bar
EOF