diff options
author | Timo Weingärtner <timo@tiwe.de> | 2013-01-04 21:12:09 +0100 |
---|---|---|
committer | Timo Weingärtner <timo@tiwe.de> | 2013-01-07 14:18:40 +0100 |
commit | b976b61bd47d0a404d94e390c429ac5e336b261a (patch) | |
tree | 2d5ad96b1ca3c83017464368b63f16b5062da49b | |
parent | 15f2c2977ee6e95893e3fb4859bdf73dd6885e8a (diff) | |
download | openssh-known-hosts-b976b61bd47d0a404d94e390c429ac5e336b261a.tar.gz |
bash style fixups
* [[ for less quoting
* -eq instead of = for numerical equality
* text manipulation instead of forking a basename(1)
-rwxr-xr-x | update-openssh-known-hosts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/update-openssh-known-hosts b/update-openssh-known-hosts index 50dee5d..8b77aee 100755 --- a/update-openssh-known-hosts +++ b/update-openssh-known-hosts @@ -14,7 +14,7 @@ path_search () { local IFS IFS=: set -- $@ - if [ "${search}" != "${search#*/}" ]; then + if [[ ${search} =~ / ]]; then echo "${search}" return 0 fi @@ -34,7 +34,7 @@ cleanup () { lockfile-remove "${LOCK}" } -if [ $# = 1 ] && [ "$1" = "-f" ]; then +if [ $# -eq 1 ] && [ "$1" = "-f" ]; then fail=1 else fail='' @@ -52,28 +52,28 @@ cd "${CACHEDIR}" find -mindepth 2 -maxdepth 2 -type f -name new -delete run-parts --list "${CONFDIR}/sources/" | while read sourcefile; do - source=`basename ${sourcefile}` + source=${sourcefile##*/} mkdir -p ${source} ( set -a cd ${source} . "${sourcefile}" - `path_search "$PLUGIN" "$PLUGIN_PATH"` >| log 2>&1 || { + $(path_search "$PLUGIN" "$PLUGIN_PATH") >| log 2>&1 || { exitcode=$? rm -f new ignore='' for e in ${EXIT_IGNORE:-0}; do - if [ "$e" = "$exitcode" ]; then + if [[ $e = $exitcode ]]; then ignore=1 break fi done - if [ "$ignore" != "1" -o "$fail" = "1" ]; then + if [ -z "$ignore" -o "$fail" ]; then echo "${source} exited with code ${exitcode}, log follows:" cat log echo fi - if [ "$fail" = "1" ]; then + if [ "$fail" ]; then exit 1 fi } >&2 |