]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsa-info.sh: Condense nested commands for formatting upload result
authorDavid Ward <david.ward@ll.mit.edu>
Sat, 21 Dec 2019 05:32:09 +0000 (00:32 -0500)
committerTakashi Iwai <tiwai@suse.de>
Tue, 7 Jan 2020 13:04:41 +0000 (14:04 +0100)
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
alsa-info/alsa-info.sh

index 7560b0d5338ed1816ebbefbb7a58379b7ba6055e..8b4745b689582b317681482c7542315719d55032 100755 (executable)
@@ -858,19 +858,15 @@ echo ""
 
 fi # dialog
 
-# See if tput is available, and use it if it is.
-if [ -n "$TPUT" ]; then
-       if [[ -z $PASTEBIN ]]; then
-               FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0)
-       else
-               FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'; tput sgr0)
-       fi
+if [ -z "$PASTEBIN" ]; then
+       FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2)
 else
-       if [[ -z $PASTEBIN ]]; then
-               FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2)
-       else
-               FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p')
-       fi
+       FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p')
+fi
+
+# See if tput is available, and use it if it is.
+if [ -x "$TPUT" ]; then
+       FINAL_URL=$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0)
 fi
 
 # Output the URL of the uploaded file.