From: Simon Ruderich Date: Mon, 18 Aug 2014 22:16:42 +0000 (+0200) Subject: use more set -eu X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=f551f4a333baf41a1abc3a8264b335f2c1681a76;p=config%2Fdotfiles.git use more set -eu --- diff --git a/bin/calc b/bin/calc index f76472f..ea3cbd3 100755 --- a/bin/calc +++ b/bin/calc @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2011-2013 Simon Ruderich +# Copyright (C) 2011-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ # along with this program. If not, see . +set -eu + exec python -i -c ' # Math functions. diff --git a/bin/chronic-log b/bin/chronic-log index b06e5cb..e8dc7ea 100755 --- a/bin/chronic-log +++ b/bin/chronic-log @@ -19,6 +19,7 @@ # along with this program. If not, see . +set -eu if test $# -lt 2; then echo "Usage: $0 .." >&2 diff --git a/bin/mv-p b/bin/mv-p index f962087..7259d33 100755 --- a/bin/mv-p +++ b/bin/mv-p @@ -3,7 +3,7 @@ # Wrapper command for `mv` which creates the target directory before moving # the file there. -# Copyright (C) 2011-2013 Simon Ruderich +# Copyright (C) 2011-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,6 +19,8 @@ # along with this program. If not, see . +set -eu + # Get last argument. for last; do : diff --git a/bin/slocate b/bin/slocate index c1ce8a4..43e1eb2 100755 --- a/bin/slocate +++ b/bin/slocate @@ -2,7 +2,7 @@ # Search only in the local `locate` database. Created with `supdatedb`. -# Copyright (C) 2012-2013 Simon Ruderich +# Copyright (C) 2012-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,4 +18,6 @@ # along with this program. If not, see . +set -eu + exec locate -d "$HOME/.tmp/locatedb" "$@" diff --git a/bin/srandom-order b/bin/srandom-order index 5469703..45297be 100755 --- a/bin/srandom-order +++ b/bin/srandom-order @@ -3,7 +3,7 @@ # Run all files in the current directory (recursively) in a random order with # the given program. -# Copyright (C) 2012-2013 Simon Ruderich +# Copyright (C) 2012-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ # along with this program. If not, see . -set -e +set -eu if test "$#" -eq 0; then echo "Usage: $0 .." >&2 diff --git a/bin/srsync b/bin/srsync index 81000fb..473429e 100755 --- a/bin/srsync +++ b/bin/srsync @@ -21,6 +21,7 @@ # along with this program. If not, see . +set -eu set -x exec rsync \ diff --git a/bin/srsync-incremental b/bin/srsync-incremental index 7fe898a..0ae1e56 100755 --- a/bin/srsync-incremental +++ b/bin/srsync-incremental @@ -21,7 +21,7 @@ # along with this program. If not, see . -set -e +set -eu if test "$#" -lt 2; then echo "Usage: $0 " >&2 @@ -31,7 +31,7 @@ if test "$#" -lt 2; then fi -cd "$1" || exit 1 +cd "$1" shift # Get absolute path to last backup directory. diff --git a/bin/supdatedb b/bin/supdatedb index a3ced0c..4f5fac0 100755 --- a/bin/supdatedb +++ b/bin/supdatedb @@ -3,7 +3,7 @@ # Generate `locate` database for my home directory only. Exclude backups and # other temporary files. -# Copyright (C) 2012-2013 Simon Ruderich +# Copyright (C) 2012-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,6 +19,8 @@ # along with this program. If not, see . +set -eu + exec updatedb \ --localpaths="$HOME" \ --prunepaths="$HOME/.tmp $HOME/tmp" \ diff --git a/bin/svalgrind b/bin/svalgrind index 3d02efe..28f7f69 100755 --- a/bin/svalgrind +++ b/bin/svalgrind @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2011-2012 Simon Ruderich +# Copyright (C) 2011-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,5 +16,7 @@ # along with this program. If not, see . +set -eu + exec valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 \ --track-fds=yes "$@" diff --git a/crontab.d/jobs.daily/prune-logs b/crontab.d/jobs.daily/prune-logs index 9295aa9..74aa1f2 100755 --- a/crontab.d/jobs.daily/prune-logs +++ b/crontab.d/jobs.daily/prune-logs @@ -18,7 +18,7 @@ # along with this program. If not, see . -set -e +set -eu logdir="$HOME/.tmp/logs" diff --git a/crontab.d/setup.sh b/crontab.d/setup.sh index 33e88c3..46ebb56 100755 --- a/crontab.d/setup.sh +++ b/crontab.d/setup.sh @@ -5,7 +5,7 @@ # # An existing crontab entry not generated with this script is not overwritten. -# Copyright (C) 2012-2013 Simon Ruderich +# Copyright (C) 2012-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ # along with this program. If not, see . -set -e +set -eu HEADER_WARNING='# WARNING! DO NOT EDIT THIS FILE! #' diff --git a/lessfilter b/lessfilter index 404cbe0..442efa9 100755 --- a/lessfilter +++ b/lessfilter @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2011-2013 Simon Ruderich +# Copyright (C) 2011-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ # along with this program. If not, see . +set -eu + case "$1" in # Color diff files. *.diff | *.patch)