diff options
-rwxr-xr-x | update-openssh-known-hosts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/update-openssh-known-hosts b/update-openssh-known-hosts index ef897aa..c8f7e39 100755 --- a/update-openssh-known-hosts +++ b/update-openssh-known-hosts @@ -28,22 +28,21 @@ OUTFILE=${OUTFILE:-/var/lib/openssh-known-hosts/ssh_known_hosts} readonly CONFDIR PLUGIN_PATH CACHEDIR LOCK OUTFILE path_search () { - search="$1" - shift - local IFS - IFS=: - set -- $@ + local search=$1 + local -a pathlist + IFS=: read -ra pathlist <<< "$2" + if [[ ${search} =~ / ]]; then echo "${search}" return 0 fi - for path; do + for path in "${pathlist[@]}"; do if [ -f "${path}/${search}" ]; then echo "${path}/${search}" return 0 fi done - echo "'${search}' not found in '$*'!" >&2 + echo "'${search}' not found in '$2'!" >&2 exit 127 } |