diff --git a/contrib/moz-script b/contrib/moz-script index 43c884d..7708ad5 100755 --- a/contrib/moz-script +++ b/contrib/moz-script @@ -1,36 +1,36 @@ #!/bin/sh # Helper script to convert to Mozilla mail format # Author: David Binard <binard@users.sf.net> # Taken from: <https://sourceforge.net/p/ol2mbox/patches/4/> # Note: this assumes readpst was run with the -r # (recursive) option. if [ "$#" != 1 ]; then - echo "Usage: `basename "$0"` <folder>" + echo "Usage: $(basename "$0") <folder>" exit 1 fi process_dir() { echo Processing directory "$1" for item in "$1/"*; do if [ -d "$item" ]; then mv "$item" "$item.sbd" touch "$item" process_dir "$item.sbd" - elif [ "`basename \"$item\"`" = mbox ]; then + elif [ "$(basename "$item")" = mbox ]; then mv "$item" "${item%%.sbd/mbox}" else echo ERROR: invalid item "$item" exit 1 fi done } item="$1" mv "$item" "$item.sbd" touch "$item" process_dir "$item.sbd"