tags 489672 + patch
thanks

Patch attached. An alternative would be to

  sed -e '[EMAIL PROTECTED]/bin/sh/#!/bin/bash@'

.. but these bashisms are all completely avoidable.


Regards,

-- 
Chris Lamb, UK                              [EMAIL PROTECTED]
                                                   GPG: 0x634F9A20
diff -urNd xdialog-2.3.1.orig/samples/gauge xdialog-2.3.1/samples/gauge
--- xdialog-2.3.1.orig/samples/gauge    2008-08-24 13:21:02.000000000 +0100
+++ xdialog-2.3.1/samples/gauge 2008-08-24 13:33:09.000000000 +0100
@@ -3,7 +3,7 @@
 
 (
 echo "10" ; sleep 1
-echo "XXX" ; echo "The new" ; echo "\\n" ; echo "message"; echo "XXX"
+echo "XXX" ; echo "The new" ; printf "\\n\n" ; echo "message"; echo "XXX"
 echo "20" ; sleep 1
 echo "50" ; sleep 1
 echo "75" ; sleep 1
diff -urNd xdialog-2.3.1.orig/samples/infobox2 xdialog-2.3.1/samples/infobox2
--- xdialog-2.3.1.orig/samples/infobox2 2008-08-24 13:21:02.000000000 +0100
+++ xdialog-2.3.1/samples/infobox2      2008-08-24 13:32:54.000000000 +0100
@@ -10,7 +10,7 @@
                echo "Box closed.";;
 esac
 
-(sleep 2;echo "XXX";echo "New";echo "\\n";echo "message";echo "XXX";sleep 
2;echo "XXXX") | \
+(sleep 2;echo "XXX";echo "New";printf "\\n\n";echo "message";echo "XXX";sleep 
2;echo "XXXX") | \
 Xdialog --title "INFO BOX 2" --no-button --infobox "Infobox test (no button)" 
10 32 0
 
 if [ "$?" = 255 ] ; then
diff -urNd xdialog-2.3.1.orig/samples/install-wrapper 
xdialog-2.3.1/samples/install-wrapper
--- xdialog-2.3.1.orig/samples/install-wrapper  2008-08-24 13:21:02.000000000 
+0100
+++ xdialog-2.3.1/samples/install-wrapper       2008-08-24 13:32:21.000000000 
+0100
@@ -12,12 +12,12 @@
 BOX_TITLE="Xdialog wrapper"
 BACKTITLE="Xdialog wrapper installation"
 
-function errors() {
-       if (( $? != 0 )) ; then
+errors() {
+       if [ $? != 0 ] ; then
                Xdialog --title "$BOX_TITLE" --backtitle "$BACKTITLE" 
--no-close \
                        --icon ./warning.xpm \
                        --yesno "An error occured, do you want\nto see details 
about it ?" 0 0
-               if (( $? == 0 )) ; then
+               if [ $? = 0 ] ; then
                        Xdialog --title "$BOX_TITLE" --backtitle "Error 
message:" --no-cancel \
                                --textbox /tmp/wrapper.$$ 20 64
                fi
@@ -40,7 +40,7 @@
 Do you want to continue (note that you
 must be root to run this script) ?" 0 0
 
-if (( $? != 0 )) ; then
+if [ $? != 0 ] ; then
        exit 0
 fi
 
@@ -48,10 +48,10 @@
 CDIALOG=""
 PATH_LIST=`echo $PATH | sed -e "y/:/ /"`
 for i in $PATH_LIST; do
-       if [ "$DIALOG" == "" ] && [ -d $i ] ; then
+       if [ "$DIALOG" = "" ] && [ -d $i ] ; then
                DIALOG=`find $i -name dialog -print`
        fi
-       if [ "$CDIALOG" == "" ] && [ -d $i ] ; then
+       if [ "$CDIALOG" = "" ] && [ -d $i ] ; then
                CDIALOG=`find $i -name cdialog -print`
        fi
 done
@@ -101,10 +101,10 @@
 GDIALOG=""
 XDIALOG=""
 for i in $PATH_LIST; do
-       if [ "$GDIALOG" == "" ] && [ -d $i ] ; then
+       if [ "$GDIALOG" = "" ] && [ -d $i ] ; then
                GDIALOG=`find $i -name gdialog -print`
        fi
-       if [ "$XDIALOG" == "" ] && [ -d $i ] ; then
+       if [ "$XDIALOG" = "" ] && [ -d $i ] ; then
                XDIALOG=`find $i -name Xdialog -print`
        fi
 done
@@ -112,7 +112,7 @@
 if [ "$XDIALOG" != "" ]  &&  [ "$GDIALOG" != "" ]  &&  ! [ -x $GDIALOG.orig ] 
; then
        Xdialog --title "$BOX_TITLE" --backtitle "$BACKTITLE" \
                --yesno "I also found \"gdialog\" on your system...\nDo you 
want \"Xdialog\" to replace it ?" 0 0
-       if (( $? == 0 )) ; then
+       if [ $? = 0 ] ; then
                mv $GDIALOG $GDIALOG.orig 2>/tmp/wrapper.$$
                errors
                ln -s $XDIALOG $GDIALOG 2>/tmp/wrapper.$$
diff -urNd xdialog-2.3.1.orig/samples/kernel xdialog-2.3.1/samples/kernel
--- xdialog-2.3.1.orig/samples/kernel   2008-08-24 13:21:02.000000000 +0100
+++ xdialog-2.3.1/samples/kernel        2008-08-24 13:30:49.000000000 +0100
@@ -4,9 +4,9 @@
 # installation. No guarantee is given on its suitability to your own system
 # though.
 
-function check_error() {
+check_error() {
        ret=$?
-       if (( $ret != 0 )) ; then
+       if [ $ret != 0 ] ; then
                echo "Error while building the kernel..."
                exit $ret
        fi
@@ -27,7 +27,7 @@
 check_error
 
 Xdialog --title "$TITLE" --yesno "make mrproper first ?" 0 0
-if (( $? == 0 )) ; then
+if [ $? = 0 ] ; then
        echo 
"--------------------------------------------------------------------------"
        echo "Making mrproper..."
        echo 
"--------------------------------------------------------------------------"
@@ -37,7 +37,7 @@
 
 if [ -f /usr/src/linux/.config ] ; then
        Xdialog --title "$TITLE" --yesno "Configure the kernel ?" 0 0
-       if (( $? == 0 )) ; then
+       if [ $? = 0 ] ; then
                echo 
"--------------------------------------------------------------------------"
                echo "Making xconfig..."
                echo 
"--------------------------------------------------------------------------"
@@ -92,7 +92,7 @@
        /bin/cp -f /boot/module-info-`uname -r` /boot/module-info-$VERSION 2>&1
 fi
 Xdialog --title "$TITLE" --yesno "Make the new kernel the current one ?" 0 0
-if (( $? == 0 )) ; then
+if [ $? = 0 ] ; then
        echo 
"--------------------------------------------------------------------------"
        echo "Making v$VERSION the current kernel... "
        echo 
"--------------------------------------------------------------------------"
@@ -103,7 +103,7 @@
        fi
        if [ -f /boot/map ] && [ -f /sbin/lilo ] && [ -f /etc/lilo.conf ] ; then
                Xdialog --title "$TITLE" --yesno "Install the new kernel with 
lilo ?" 0 0
-               if (( $? == 0 )) ; then
+               if [ $? = 0 ] ; then
                        echo 
"--------------------------------------------------------------------------"
                        echo "Running lilo... "
                        echo 
"--------------------------------------------------------------------------"
diff -urNd xdialog-2.3.1.orig/samples/logbox xdialog-2.3.1/samples/logbox
--- xdialog-2.3.1.orig/samples/logbox   2008-08-24 13:21:02.000000000 +0100
+++ xdialog-2.3.1/samples/logbox        2008-08-24 13:27:51.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 LOGFILE=/tmp/logbox.tmp.$$
 
@@ -37,15 +37,15 @@
 echo "Normal text." >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 sleep 1
-echo -e "\\033[1;31mThis is a red foreground text." >>$LOGFILE
+printf "\\033[1;31mThis is a red foreground text.\n" >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 echo "Normal text." >>$LOGFILE
-echo -e "\\033[1;42mThis is a green background text." >>$LOGFILE
+printf "\\033[1;42mThis is a green background text.\n" >>$LOGFILE
 sleep 1
 echo "Normal text." >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 sleep 1
-echo -e "And now a blue text\\033[1;34;46m on cyan background." >>$LOGFILE
+printf "And now a blue text\\033[1;34;46m on cyan background.\n" >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 sleep 2
diff -urNd xdialog-2.3.1.orig/samples/logbox2 xdialog-2.3.1/samples/logbox2
--- xdialog-2.3.1.orig/samples/logbox2  2008-08-24 13:21:02.000000000 +0100
+++ xdialog-2.3.1/samples/logbox2       2008-08-24 13:25:44.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 LOGFILE=/tmp/logbox.tmp.$$
 
@@ -39,21 +39,21 @@
 echo "Normal text." >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 sleep 1
-echo -e "\\033[1;31mThis is a red foreground text." >>$LOGFILE
+printf "\\033[1;31mThis is a red foreground text.\n" >>$LOGFILE
 echo "Idem." >>$LOGFILE
 echo "Idem." >>$LOGFILE
-echo -e "\\033[1;38mRevert to normal text." >>$LOGFILE
+printf "\\033[1;38mRevert to normal text.\n" >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 echo "Normal text." >>$LOGFILE
-echo -e "\\033[1;42mThis is a green background text." >>$LOGFILE
+printf "\\033[1;42mThis is a green background text.\n" >>$LOGFILE
 sleep 1
 echo "Idem." >>$LOGFILE
-echo -e "\\033[1;48mRevert to normal text." >>$LOGFILE
+printf "\\033[1;48mRevert to normal text.\n" >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 sleep 1
-echo -e "And now a blue text\\033[1;34;46m on cyan background." >>$LOGFILE
+printf "And now a blue text\\033[1;34;46m on cyan background.\n" >>$LOGFILE
 echo "Idem." >>$LOGFILE
-echo -e "\\033[1;38;48mRevert to normal text." >>$LOGFILE
+printf "\\033[1;38;48mRevert to normal text.\n" >>$LOGFILE
 echo "Normal text." >>$LOGFILE
 sleep 2
 
diff -urNd xdialog-2.3.1.orig/samples/set-time xdialog-2.3.1/samples/set-time
--- xdialog-2.3.1.orig/samples/set-time 2008-08-24 13:21:02.000000000 +0100
+++ xdialog-2.3.1/samples/set-time      2008-08-24 13:29:20.000000000 +0100
@@ -24,13 +24,13 @@
 # then ask the user...
 if [ -f /etc/adjtime ] ; then
        UTC=`grep UTC /etc/adjtime`
-       if [ "$UTC" == "UTC" ] ; then
+       if [ "$UTC" = "UTC" ] ; then
                UTC="--utc"
        fi
 else
        if [ -f /etc/sysconfig/clock ] ; then
                . /etc/sysconfig/clock
-               if [ "$UTC" == "no" ] || [ "$UTC" == "false" ] ; then
+               if [ "$UTC" = "no" ] || [ "$UTC" = "false" ] ; then
                        UTC=""
                else
                        UTC="--utc"
@@ -50,7 +50,7 @@
 
 # Get the date (returned in DD/MM/YYYY format by Xdialog.
 ENTEREDDATE=`Xdialog --stdout --title "$TITLE" --calendar "Please set the 
date..." 0 0 0 0 0`
-if (( $? != 0 )) ; then
+if [ $? != 0 ] ; then
        abort
 fi
 
@@ -59,7 +59,7 @@
 
 # Get the time in HH:MM:SS format.
 NEWTIME=`Xdialog --stdout --title "$TITLE" --timebox "Please set the time..." 
0 0`
-if (( $? != 0 )) ; then
+if [ $? != 0 ] ; then
        abort
 fi
 
@@ -71,12 +71,12 @@
 # Set the hardware clock (RTC) and then the system clock, appending any error
 # message to the error log...
 /sbin/hwclock --set $UTC --date "$NEWDATE $NEWTIME" 2>>/tmp/set-time.err.$$
-if (( $? == 0 )) ; then
+if [ $? == 0 ] ; then
        /sbin/hwclock --hctosys $UTC 2>>/tmp/set-time.err.$$
 fi
 
 # Give the result (success or failure+reason)...
-if (( $? == 0 )) ; then
+if [ $? == 0 ] ; then
        Xdialog --title "$TITLE" --msgbox "The system clock has been set." 0 0
 else
        Xdialog --title "$TITLE" --textbox /tmp/set-time.err.$$ 60 30
diff -urNd xdialog-2.3.1.orig/samples/xlock-wrapper 
xdialog-2.3.1/samples/xlock-wrapper
--- xdialog-2.3.1.orig/samples/xlock-wrapper    2008-08-24 13:21:02.000000000 
+0100
+++ xdialog-2.3.1/samples/xlock-wrapper 2008-08-24 13:26:25.000000000 +0100
@@ -22,7 +22,7 @@
 ret=$?
 rm -f $MENU
 
-if (( $ret != 0 )) ; then
+if [ $ret != 0 ] ; then
        exit 0
 fi
 
diff -urNd xdialog-2.3.1.orig/samples/Xmessage xdialog-2.3.1/samples/Xmessage
--- xdialog-2.3.1.orig/samples/Xmessage 2008-08-24 13:21:02.000000000 +0100
+++ xdialog-2.3.1/samples/Xmessage      2008-08-24 13:27:05.000000000 +0100
@@ -122,13 +122,13 @@
        # Now, as long as the TIMEOUT is not 0, sleep for one second, check
        # for Xdialog still being there (if not then exit immediately) and
        # decrement the TIMEOUT.
-       while (( $TIMEOUT > 0 )) ; do
+       while [ $TIMEOUT > 0 ] ; do
                sleep 1
                STILL_THERE=`ps | awk --source "$SOURCE"`
                if [ "$STILL_THERE" = "" ] ; then
                        exit 0
                fi
-               let TIMEOUT=$TIMEOUT-1
+               TIMEOUT=$(($TIMEOUT-1))
        done
        # Time is over !   Kill Xdialog and exit.
        kill $XDIALOG_PID 2>/dev/null

Attachment: signature.asc
Description: PGP signature

Reply via email to