[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#465376: varkon: bashism in /bin/sh script



There were two errors when I ran checkbashisms on the patched version.
Corrected patch attached.

-- 
Tim Retout <tim@retout.co.uk>
--- varkon-1.18A-new/debian/varkon.sh	2009-02-15 14:46:42.000000000 +0000
+++ varkon-1.18A/debian/varkon.sh	2009-02-17 01:21:08.000000000 +0000
@@ -20,8 +20,8 @@
     while [ "$ans" != "y" -a "$ans" != "n" ] ; do
 	if [ "$ans" ] ; then echo "Please answer either \`y\' or \`n\'"; fi
 	echo "The directory where varkon stores the $2 does not exist."
-	echo -e "\t$1"
-	echo -n "Shall I create it? [Y|n] " > /dev/tty
+	printf "\t$1\n"
+	printf "Shall I create it? [Y|n] " > /dev/tty
 	read ans < /dev/tty
 	ans="`echo $ans | tr A-Z a-z`"
 	ans=${ans:-y}
@@ -92,7 +92,7 @@
 }
 
 # Check for root
-if [ $UID = 0 ]; then
+if [ $(id -ru) = 0 ]; then
     # Check if variable and file $VARKON_INI exist
     if [ -z $VARKON_INI ]; then
 	error "\$VARKON_INI not set"
@@ -180,10 +180,10 @@
 while [ $change = 1 ] ; do
     # Show the current configuration
     echo
-    echo -e "Configuration:\tcurrent  (old)"
-    echo -e "`if [ "$NEW_HTML_VIEWER" != "$HTML_VIEWER" ]; then echo -n '*'; else echo -n " "; fi`1 html_viewer:\t$NEW_HTML_VIEWER  ($HTML_VIEWER)"
-    echo -e "`if [ "$NEW_MBS_EDITOR" != "$MBS_EDITOR" ]; then echo -n '*'; else echo -n " "; fi`2 mbseditor:\t$NEW_MBS_EDITOR  ($MBS_EDITOR)"
-    echo -e "`if [ "$NEW_MBS_EMULATOR" != "$MBS_EMULATOR" ]; then echo -n '*'; else echo -n " "; fi`3 mbsemulator:\t$NEW_MBS_EMULATOR  ($MBS_EMULATOR)"
+    printf "Configuration:\tcurrent  (old)\n"
+    printf "`if [ "$NEW_HTML_VIEWER" != "$HTML_VIEWER" ]; then echo -n '*'; else echo -n " "; fi`1 html_viewer:\t$NEW_HTML_VIEWER  ($HTML_VIEWER)\n"
+    printf "`if [ "$NEW_MBS_EDITOR" != "$MBS_EDITOR" ]; then echo -n '*'; else echo -n " "; fi`2 mbseditor:\t$NEW_MBS_EDITOR  ($MBS_EDITOR)\n"
+    printf "`if [ "$NEW_MBS_EMULATOR" != "$MBS_EMULATOR" ]; then echo -n '*'; else echo -n " "; fi`3 mbsemulator:\t$NEW_MBS_EMULATOR  ($MBS_EMULATOR)\n"
 
     # Ask if user want to change anything
     ans=""
@@ -336,7 +336,7 @@
 
 # Source the system wide configuration
 if [ -f $SYSINI ]; then
-    source $SYSINI
+    . $SYSINI
 fi
 
 # Check for "-h|-?|--help" in command options
@@ -395,7 +395,7 @@
 
 # Source the user configuration
 if [ -f $USERINI ]; then
-    source $USERINI
+    . $USERINI
 fi
 
 # Switch to configuration

Reply to: