From f1b7212e0220054bcdd4053d808939dfe3a1f52e Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sat, 21 Jan 2012 10:22:45 +0000 Subject: make tag-photo.bash script exit nicer meaning, "return" if sourced in Signed-off-by: Michael Krelin --- diff --git a/doc/tag-photo.bash b/doc/tag-photo.bash index 83f10fd..5917f12 100644 --- a/doc/tag-photo.bash +++ b/doc/tag-photo.bash @@ -42,11 +42,11 @@ END { } ')" -[[ -z "$APS" ]] && { echo "no access points" ; exit ; } +[[ -z "$APS" ]] && { echo "no access points" ; return 2>/dev/null || exit ; } WL="$(wps_locate "$APS")" -[[ -z "$WL" ]] && { echo "couldn't find location" ; exit ; } +[[ -z "$WL" ]] && { echo "couldn't find location" ; return 2>/dev/null || exit ; } eval "$WL" -[[ -z "$wl_latitude" || -z "$wl_longitude" || -z "$wl_hpe" ]] && { echo "invalid location ($WL)"; exit; } +[[ -z "$wl_latitude" || -z "$wl_longitude" || -z "$wl_hpe" ]] && { echo "invalid location ($WL)"; return 2>/dev/null || exit; } [[ "${wl_latitude:0:1}" = '-' ]] && wl_latitude="${wl_latitude:1}" wl_latitude_ref=S || wl_latitude_ref=N [[ "${wl_longitude:0:1}" = '-' ]] && wl_longitude="${wl_longitude:1}" wl_longitude_ref=W || wl_longitude_ref=E exiftool -GPSLatitude="$wl_latitude" -GPSLongitude="$wl_longitude" -GPSLatitudeRef=$wl_latitude_ref -GPSLongitudeRef=$wl_longitude_ref -GPSVersionID=0.0.2.2 -GPSProcessingMethod=WLAN "$JPG" -- cgit v0.9.0.2