aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-08-14 11:42:56 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2016-08-14 11:42:56 +0200
commit3b713427c07f042852c826efb0010e4bb3404b0c (patch)
tree664918bc4a11cab4f5ac9894e7b16a083f03e2a2
parentexport PYTHONSTARTUP (diff)
downloadlinux-home-3b713427c07f042852c826efb0010e4bb3404b0c.tar.gz
linux-home-3b713427c07f042852c826efb0010e4bb3404b0c.zip
set -o errexit -o nounset -o pipefail in functions
Diffstat (limited to '')
-rw-r--r--.bashrc_cxx12
-rw-r--r--.bashrc_distr8
-rw-r--r--.bashrc_git16
-rw-r--r--.bashrc_netwrix3
-rw-r--r--.bashrc_third_party18
5 files changed, 33 insertions, 24 deletions
diff --git a/.bashrc_cxx b/.bashrc_cxx
index 6945590..af11332 100644
--- a/.bashrc_cxx
+++ b/.bashrc_cxx
@@ -9,11 +9,11 @@ fi
C_FLAGS=('-Wall' '-Wextra')
runc() (
- set -o errexit
+ set -o errexit -o nounset -o pipefail
local -a c_flags=("${C_FLAGS[@]}")
- local -a src_files=()
- local -a prog_flags=()
+ local -a src_files
+ local -a prog_flags
while [ "$#" -gt 0 ]; do
case "$1" in
@@ -65,11 +65,11 @@ runc() (
CXX_FLAGS=('-Wall' '-Wextra' '-std=c++14')
runcxx() (
- set -o errexit
+ set -o errexit -o nounset -o pipefail
local cxx_flags=("${CXX_FLAGS[@]}")
- local -a src_files=()
- local -a prog_flags=()
+ local -a src_files
+ local -a prog_flags
while [ "$#" -gt 0 ]; do
case "$1" in
diff --git a/.bashrc_distr b/.bashrc_distr
index a680b6b..f573653 100644
--- a/.bashrc_distr
+++ b/.bashrc_distr
@@ -12,14 +12,18 @@ update_checksums() {
sha1sum -- "$@" > "$checksums_path"
}
-update_checksums_distr() {
+update_checksums_distr() (
+ set -o errexit -o nounset -o pipefail
+
local -a paths
local path
+
while IFS= read -d '' -r path; do
paths+=("$path")
done < <( find . -type f -\( -iname '*.exe' -o -iname '*.iso' -\) -print0 )
+
update_checksums "${paths[@]+"${paths[@]}"}"
-}
+)
verify_checksums() {
sha1sum --check "$checksums_path"
diff --git a/.bashrc_git b/.bashrc_git
index e5eaf3f..5b930a1 100644
--- a/.bashrc_git
+++ b/.bashrc_git
@@ -7,6 +7,8 @@ else
fi
list_repo_files() (
+ set -o errexit -o nounset -o pipefail
+
local -a cmd=(git ls-files)
while [ "$#" -gt 0 ]; do
@@ -32,8 +34,7 @@ list_repo_files() (
)
list_repo_dirs() (
- set -o errexit
- set -o pipefail
+ set -o errexit -o nounset -o pipefail
local terminator='\n'
@@ -64,8 +65,7 @@ list_repo_dirs() (
)
tighten_repo_security() (
- set -o errexit
- set -o pipefail
+ set -o errexit -o nounset -o pipefail
list_repo_files -z | xargs -0 chmod 0600
list_repo_dirs -z | xargs -0 chmod 0700
@@ -73,7 +73,7 @@ tighten_repo_security() (
)
backup_repo() (
- set -o errexit
+ set -o errexit -o nounset -o pipefail
local repo_dir
repo_dir="$( realpath . )"
@@ -98,6 +98,8 @@ backup_repo() (
HEAD
)
-backup_repo_dropbox() {
+backup_repo_dropbox() (
+ set -o errexit -o nounset -o pipefail
+
backup_repo "$USERPROFILE/Dropbox/backups"
-}
+)
diff --git a/.bashrc_netwrix b/.bashrc_netwrix
index 557e333..c1df671 100644
--- a/.bashrc_netwrix
+++ b/.bashrc_netwrix
@@ -14,8 +14,7 @@ export nwx_dev2=172.28.19.60
export nwx_dev3=172.28.19.61
lint_webapi() (
- set -o errexit
- set -o pipefail
+ set -o errexit -o nounset -o pipefail
local root_dir='/cygdrive/c/Netwrix Auditor/CurrentVersion-AuditCore-Dev/AuditCore/Sources'
diff --git a/.bashrc_third_party b/.bashrc_third_party
index 48ea0b9..e90e39a 100644
--- a/.bashrc_third_party
+++ b/.bashrc_third_party
@@ -19,15 +19,15 @@ ensure_symlinks_enabled() {
}
symlink_preferences() (
- set -o errexit
-
- ensure_symlinks_enabled
+ set -o errexit -o nounset -o pipefail
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} SRC_DIR DEST_DIR" >&2
return 1
fi
+ ensure_symlinks_enabled
+
local src_dir="$1"
local dest_dir="$2"
@@ -36,10 +36,14 @@ symlink_preferences() (
find "$src_dir" -maxdepth 1 -type f -exec ln --force -s {} "$dest_dir" \;
)
-symlink_sublime_preferences() {
+symlink_sublime_preferences() (
+ set -o errexit -o nounset -o pipefail
+
symlink_preferences "$HOME/.Sublime Text 3" "$APPDATA/Sublime Text 3/Packages/User"
-}
+)
+
+symlink_ghc_preferences() (
+ set -o errexit -o nounset -o pipefail
-symlink_ghc_preferences() {
symlink_preferences "$HOME/.GHC" "$APPDATA/ghc"
-}
+)