Bash
Scripts
Starting point bash script:
#/usr/bin/env bash
set -euo pipefail
# -e strict, stop on error
# -u stop on undefined user variables
# -o stop on pipe | failures
Import environment variables from a file
export $(xargs < .env)
Resources
- Become a shell wizard in ~12 mins
- https://learnxinyminutes.com/docs/bash/
- Become a bash scripting pro - full course TODO: Take notes from videos above. Good reference sheet.
ssh tunnel:
ssh admin@10.36.8.43 -T -L 3631:localhost:631
Simple rsync starter:
#!/usr/bin/env bash
set -euo pipefail
FILES="
startbackup.sh
.ssh
hosts.txt
vimwiki
"
exclude="--exclude node_modules --exclude .git"
rsync $exclude --archive --partial --progress --human-readable --update --copy-links $FILES /mnt/backups/$(uname --nodename)/