How can I write a here document to a file in a script?
try to use tee:
tee newfile <<EOF
It's concise and can be combined with sudo if you need to write to files with root permissions.
Your first problem can be solved like ...READ MORE
You can use this:
stat -c "%a %n" ...READ MORE
You can use if-else branch to check ...READ MORE
To create a symbolic link, you can ...READ MORE
Try using systemd isntead of a cron ...READ MORE
I needed to do a similar thing ...READ MORE
Is your problem is not with the ...READ MORE
The scope of an alias command is the shell ...READ MORE
$0 will give you the complete basename. ...READ MORE
You don't actually have to call the ...READ MORE