info-mtools
[Top][All Lists]
Advanced

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

[Mtools] amuFormat.sh in bash instead csh


From: Adam Tkac
Subject: [Mtools] amuFormat.sh in bash instead csh
Date: Fri, 11 May 2007 15:56:54 +0200
User-agent: Thunderbird 2.0.0.0 (X11/20070419)

Hi all,

I've rewritten amuFormat.sh script to bash because bash is used much more than csh. Are you going to include modified script in next release?

Regards, Adam
--- mtools-3.9.10/scripts/amuFormat.sh.sh       2007-05-11 10:33:36.000000000 
+0200
+++ mtools-3.9.10/scripts/amuFormat.sh  2007-05-11 10:46:55.000000000 +0200
@@ -1,4 +1,4 @@
-#!/bin/csh 
+#!/bin/bash
 #
 #  amuFormat.sh  Formats various types and sizes of PC-Cards, according to the
 #  AMU-specification
@@ -11,9 +11,8 @@
 #
 #  10-12-2003    lct   created
 #
-set vers=1.4
-set fdrive="f:"
-
+vers=1.4
+fdrive="f:"
 
 #echo "debug: $0,$1,$2,$3,$4"
 
@@ -22,28 +21,29 @@ set fdrive="f:"
 #
 echo "amuFormat $vers started..."
 
-if ( $#argv == 0 ) then
-   echo "Usage: amuFormat.sh <Card Type> <drive>"
-   echo "<Card Type> has to be defined in amuFormat.sh itself"
-   echo "<drive> has to be defined in mtools.conf"
-   echo ""
-   exit 0
-endif
+if [ $# -eq 0 ] ; then
+   cat <<-EOF
+       Usage: amuFormat.sh <Card Type> <drive>
+       <Card Type> has to be defined in amuFormat.sh itself
+       <drive> has to be defined in mtools.conf
+EOF
+    exit 0
+fi
 
 
 echo "Formatting card in slot $2 as $1"
 
-if ( $1 == "8MBCARD-FW" ) then
+if [ "x$1" == "x8MBCARD-FW" ] ; then
    
    ## determine formatting drive
-   if ( ($2 == "b:") || ($2 == "B:") ) then
-      set fdrive = "f:"
-   else if ( ($2 == "c:") || ($2 == "C:" ) ) then
-           set fdrive = "g:"
+   if [ ( "x$2" == "xb:") || ( "x$2" == "xB:") ] ; then
+      fdrive="f:"
+   elif [ ( "x$2" == "xc:") || ( "x$2" == "xC:" ) ] ; then
+      fdrive="g:"
    else
       echo "Drive $2 not supported."
       exit 1
-   endif
+   fi
          
    ## initialise partition table
    mpartition -I $fdrive
@@ -61,9 +61,9 @@ if ( $1 == "8MBCARD-FW" ) then
    echo "done."
    exit 0
 
-endif
+fi
 
-if ( $1 == "32MBCARD-FW" ) then
+if [ "x$1" == "x32MBCARD-FW" ] ; then
    
    #from amu_toolkit_0_6: mformat -t489 -h4 -c4 -n32 -H32 -r32 -vPC-CARD -M512 
-N0000 c:
   
@@ -82,9 +82,9 @@ if ( $1 == "32MBCARD-FW" ) then
    echo "done."
    exit 0
 
-endif
+fi
 
-if ( $1 == "64MBCARD-FW" ) then
+if [ "x$1" == "x64MBCARD-FW" ] ; then
 
    echo "***** WARNING: untested on AvHMU, exiting *****"
    exit 0
@@ -105,10 +105,10 @@ if ( $1 == "64MBCARD-FW" ) then
    exit 0
 
 
-endif
+fi
 
 
-if ( $1 == "1GBCARD-FW" ) then
+if [  "x$1" == "x1GBCARD-FW" ] ; then
 
    # from amu_toolkit_0_6: mformat -t2327 -h16 -c64 -n63 -H63 -r32 -v AMU-CARD 
-M512 -N 0000 c:
    
@@ -130,9 +130,9 @@ if ( $1 == "1GBCARD-FW" ) then
    exit 0
 
 
-endif
+fi
 
-if ( $1 == "64MBCARDSAN" ) then
+if [ "x$1" == "x64MBCARDSAN" ] ; then
    
    # from amu_toolkit_0_6: mformat -t489 -h8 -c4 -n32 -H32 -r32 -v AMU-CARD 
-M512 -N 0000 c:
 
@@ -152,7 +152,7 @@ if ( $1 == "64MBCARDSAN" ) then
    exit 0
 
 
-endif
+fi
 
 #
 # insert new cards here...
@@ -160,5 +160,3 @@ endif
 
 echo "Card not supported."
 exit 1
- 
- 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]