Make the local variables const. Delete the temp file.
David Blume

David Blume commited on 2019-05-04 22:47:03
Showing 1 changed files, with 5 additions and 4 deletions.

... ...
@@ -69,20 +69,21 @@ alias clip="expand | cut -b1-\$COLUMNS"
69 69
 alias https='http --default-scheme=https'
70 70
 
71 71
 md() {
72
-    local sys_name=$(uname -s)
72
+    declare -r sys_name=$(uname -s)
73 73
     if [[ $sys_name == Darwin* ]]; then
74
-        T=$(mktemp $TMPDIR$(uuidgen).html)
74
+        declare -r T=$(mktemp $TMPDIR$(uuidgen).html)
75 75
         curl -s -X POST --data-binary @"$1" https://md.dlma.com/ > $T
76 76
         open $T
77 77
     elif [[ $sys_name == CYGWIN* ]]; then
78
-        T=$(mktemp --suffix=.html)
78
+        declare -r T=$(mktemp --suffix=.html)
79 79
         curl -s -X POST --data-binary @"$1" https://md.dlma.com/ > $T
80 80
         cygstart $T
81 81
     else
82
-        T=$(mktemp --suffix=.html)
82
+        declare -r T=$(mktemp --suffix=.html)
83 83
         curl -s -X POST --data-binary @"$1" https://md.dlma.com/ > $T
84 84
         xdg-open $T
85 85
     fi
86
+    rm $T
86 87
 }
87 88
 
88 89
 if [ -f $HOME/.localrc ]; then
89 90