strict use "" in whatnow2
[mmh] / uip / whatnow2.sh
index 59e91b7..4e76766 100755 (executable)
@@ -92,7 +92,7 @@ create()
        fi
        mhmetafile=$mhdraft.meta
        touch $mhmetafile
-       if [ -z $mheditor ]
+       if [ -z "$mheditor" ]
        then
                get_editor
        fi
@@ -145,23 +145,23 @@ list()
 
 sendfunktion()
 {
-       export mhaltmsg=`anno -list -component 'mhaltmsg' $mhmetafile`
-       export mhdist=`anno -list -component 'mhdist' $mhmetafile`
-       export mhuse=`anno -list -component 'mhuse' $mhmetafile`
-       export mhfolder=`anno -list -component 'mhfolder' $mhmetafile`
-       export mhmessages=`anno -list -component 'mhmessages' $mhmetafile`
-       export mhannotate=`anno -list -component 'mhannotate' $mhmetafile`
-       send "$@" $mhdraft || exit $?
-       rm -f $mhmetafile
+       export mhaltmsg=`anno -list -component 'mhaltmsg' "$mhmetafile"`
+       export mhdist=`anno -list -component 'mhdist' "$mhmetafile"`
+       export mhuse=`anno -list -component 'mhuse' "$mhmetafile"`
+       export mhfolder=`anno -list -component 'mhfolder' "$mhmetafile"`
+       export mhmessages=`anno -list -component 'mhmessages' "$mhmetafile"`
+       export mhannotate=`anno -list -component 'mhannotate' "$mhmetafile"`
+       send "$@" "$mhdraft" || exit $?
+       rm -f "$mhmetafile"
        exit 0
 }
 
 delete()
 {
-       folder -push $draftfolder >/dev/null 2>&1
-       rmm $draftfolder c
+       folder -push "$draftfolder" >/dev/null 2>&1
+       rmm "$draftfolder" c
        folder -pop >/dev/null 2>&1
-       rm $mhmetafile
+       rm "$mhmetafile"
 }
 
 attach()
@@ -179,7 +179,7 @@ attach()
                        exit 1
                fi
                file=`get_realpath "$1"`
-               anno -nodate -append -component $header -text "$file" $mhdraft
+               anno -nodate -append -component "$header" -text "$file" "$mhdraft"
                shift
        done
 }
@@ -187,7 +187,7 @@ attach()
 alist()
 {
        header=`mhparam 'Attachment-Header'`
-       anno -list -number -component $header $mhdraft
+       anno -list -number -component "$header" "$mhdraft"
 }
 
 detach()
@@ -195,7 +195,7 @@ detach()
        header=`mhparam 'Attachment-Header'`
        while [ -n "$1" ]
        do
-               anno -delete -component $header -number "$1" $mhdraft
+               anno -delete -component "$header" -number "$1" "$mhdraft"
                if [ $? -ne 0 ]
                then
                        echo "can't delet attachment $1" 1>&2
@@ -207,14 +207,14 @@ detach()
 
 display()
 {
-       mhaltmsg=`anno -list -component 'mhaltmsg' $mhmetafile`
+       mhaltmsg=`anno -list -component 'mhaltmsg' "$mhmetafile"`
        get_showproc
        if [ -z "$mhaltmsg" ]
        then
                echo "no altmsg" 1>&2
                exit 1
        fi
-       exec $mhshowproc -file $mhaltmsg
+       exec $mhshowproc -file "$mhaltmsg"
 }
 
 if [ $# -eq 0 ]
@@ -223,19 +223,19 @@ then
        exit
 fi
 
-command=$1
+command="$1"
 shift
 
 draftfolder=`mhparam draftfolder`
 
-mhdraft=`mhpath $draftfolder c 2>/dev/null`
+mhdraft=`mhpath "$draftfolder" c 2>/dev/null`
 if [ -z "$mhdraft" ]
 then
-       case $command in
-       -h*)
+       case "$command" in
+       -h|-he|-hel|-help)
                usage $#
                ;;
-       -V*)
+       -V|-Ve|-Ver|-Vers|-Versi|-Versio|-Version)
                version $#
                ;;
        *)
@@ -244,11 +244,11 @@ then
                ;;
        esac
 fi
-mhmetafile=$mhdraft.meta
-touch $mhmetafile
+mhmetafile="$mhdraft".meta
+touch "$mhmetafile"
 
 
-case $command in
+case "$command" in
 e|ed|edi|edit)
        edit "$@"
        ;;
@@ -278,10 +278,10 @@ det|deta|detac|detach)
        detach "$@"
        ;;
 r|re|ref|refi|refil|refile)
-       refile -file $mhdraft "$@"
+       refile -file "$mhdraft" "$@"
        ;;
 w|wh|who|whom)
-       whom "$@" $mhdraft
+       whom "$@" "$mhdraft"
        ;;
 -h|-he|-hel|-help)
        usage $#