From 81af13a1ae32fdc21e8093d590113679b6e78ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Tue, 31 Dec 2024 11:03:56 +0100 Subject: [PATCH] Add bash strict options. --- backup | 3 +++ clearmem | 3 +++ install-script | 5 ++++- iplocate | 3 +++ monero-client | 5 ++++- setbg | 2 ++ ssh-tunnel | 4 +++- sync-camera | 2 +- weather | 5 ++++- 9 files changed, 27 insertions(+), 5 deletions(-) diff --git a/backup b/backup index b9d3013..975001b 100755 --- a/backup +++ b/backup @@ -1,2 +1,5 @@ #!/bin/bash + +set -euo pipefail + rsync -aAXv --delete "$1" --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/media/music/*"} "$2" diff --git a/clearmem b/clearmem index 6fe4cca..3845b93 100755 --- a/clearmem +++ b/clearmem @@ -1,2 +1,5 @@ #!/bin/bash + +set -euo pipefail + sync && echo 1 > /proc/sys/vm/drop_caches diff --git a/install-script b/install-script index 0d50a7b..88a8b93 100755 --- a/install-script +++ b/install-script @@ -1,2 +1,5 @@ -#!/bin/sh +#!/bin/bash + +set -euo pipefail + install -m 755 $1 $HOME/.local/bin diff --git a/iplocate b/iplocate index 18778aa..2f13d8c 100755 --- a/iplocate +++ b/iplocate @@ -1,2 +1,5 @@ #!/bin/bash + +set -euo pipefail + curl ipinfo.io/$1 diff --git a/monero-client b/monero-client index c26c036..a2e23ba 100755 --- a/monero-client +++ b/monero-client @@ -1,4 +1,7 @@ -#!/bin/sh +#!/bin/bash + +set -euo pipefail + [ "$#" -eq 0 ] && echo "Requires a command. Run with 'help' for a list of commands." && exit 1 diff --git a/setbg b/setbg index fcc4bc6..f8c677d 100755 --- a/setbg +++ b/setbg @@ -1,5 +1,7 @@ #!/bin/bash +set -euo pipefail + if [ $# -gt 1 ] then echo "Too many arguments" diff --git a/ssh-tunnel b/ssh-tunnel index c540da0..8877c2a 100755 --- a/ssh-tunnel +++ b/ssh-tunnel @@ -1,4 +1,6 @@ -#!/bin/sh +#!/bin/bash + +set -euo pipefail # TODO: # - Add options for port diff --git a/sync-camera b/sync-camera index 90eecb1..8f51fed 100755 --- a/sync-camera +++ b/sync-camera @@ -1,6 +1,6 @@ #!/bin/bash -set -eu +set -euo pipefail CAMERA_DEVICE="" MOUNT_DIR="/tmp/camera-mount" diff --git a/weather b/weather index dfd9b2f..a8963e1 100755 --- a/weather +++ b/weather @@ -1,2 +1,5 @@ -#!/bin/sh +#!/bin/bash + +set -euo pipefail + curl "http://wttr.in/$1?m"