Index: /gs2-extensions/xsd-to-gs-metaset/Readme.txt
===================================================================
--- /gs2-extensions/xsd-to-gs-metaset/Readme.txt	(revision 28382)
+++ /gs2-extensions/xsd-to-gs-metaset/Readme.txt	(revision 28383)
@@ -8,4 +8,7 @@
 3. Then run the script in this extension as follows:
 xsd_to_mds.bat C:\<full-path>\CDWALite-xsd-public-v1-1.xsd cdwalite CDWALite
+
+On Linux:
+./xsd_to_mds.bash /<full-path>/CDWALite-xsd-public-v1-1.xsd cdwalite CDWALite
 
 This script uses the GSDLHOME/bin/java/ApplyXSLT to apply the XSLT file gli\classes\xml\xsd-to-mds.xsl to the downloaded input xsd file. It thereby generates an *.mds file (using the name given in the 3rd argument) in gli's metadata folder.
@@ -23,5 +26,4 @@
 
 The above takes the xsLt file xsd-to-mds.xsl and applies it to the input Xml file (CDWALite-xsd-public-v1-1.xsd) to generate the Output file check.mds.
-Specifying the output type and indentation
 
-See more at Writing_XSL#Running_ApplyXSLT_to_apply_an_XSLT_file_from_the_command_line
+See more on the internal wiki page at Writing_XSL#Running_ApplyXSLT_to_apply_an_XSLT_file_from_the_command_line 
Index: /gs2-extensions/xsd-to-gs-metaset/xsd_to_mds.bash
===================================================================
--- /gs2-extensions/xsd-to-gs-metaset/xsd_to_mds.bash	(revision 28383)
+++ /gs2-extensions/xsd-to-gs-metaset/xsd_to_mds.bash	(revision 28383)
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+function usage () {
+    echo ""
+    echo "Run as $0 <xsd file> <namespace> <setname (mds file name)>"
+    echo "E.g. xsd_to_mds.bat C:\<full-path>\CDWALite-xsd-public-v1-1.xsd cdwalite CDWALite"
+    echo ""
+}
+
+# Check for 3 cmd line args
+if [ -z "$3" ]; then
+    usage
+fi
+
+# xsd input file and setName of mds file for output
+xsd=$1
+mds=$2
+
+if [ ! -f "$xsd" ]; then
+    echo "XSD file $xsd does not exist."
+    exit -1
+fi
+
+if [ "x$GSDLHOME" = "x" ]; then
+    echo "No GSDLHOME set. Source the (gs3-)setup.(ba)sh file in your Greenstone before running this script."
+    exit -1
+fi
+
+outputdir=
+if [ "x$GSDL3SRCHOME" != "x" ]; then
+    outputdir=$GSDL3SRCHOME
+else
+    outputdir=$GSDLHOME
+fi
+outputfile=$outputdir/gli/metadata/$mds.mds
+xsl=$outputdir/gli/classes/xml/xsd-to-mds.xsl
+
+if [ ! -f "$xsl" ]; then
+    echo "XSLT file $xsl can't be found."
+    exit -1
+fi
+
+# See internal wiki page Writing_XSL#Running_ApplyXSLT_to_apply_an_XSLT_file_from_the_command_line
+# Bash doesn't like quotes (escaped quotes) around _any_ of the file paths below.
+mycmd="java -cp $GSDLHOME/bin/java/xalan.jar:$GSDLHOME/bin/java/ApplyXSLT.jar:$GSDLHOME/bin/java/. org.nzdl.gsdl.ApplyXSLT -t $xsl -x $xsd -o $outputfile"
+
+
+# Call the command
+$mycmd
+status=$?
+
+# http://stackoverflow.com/questions/11079017/operations-on-boolean-variables
+if [ $status != 0 ]; then
+    echo "*** Failed running: $mycmd"
+    echo "Return status: $status"
+    exit -1
+elif [ ! -e "$outputfile" ]; then
+    echo "**** XSLT transform failed: the file $outputfile was not generated. Ran command:"
+    echo "$mycmd"
+    exit -1
+else
+    echo "The file $outputfile has been generated."
+fi
+echo ""
Index: /gs2-extensions/xsd-to-gs-metaset/xsd_to_mds.bat
===================================================================
--- /gs2-extensions/xsd-to-gs-metaset/xsd_to_mds.bat	(revision 28382)
+++ /gs2-extensions/xsd-to-gs-metaset/xsd_to_mds.bat	(revision 28383)
@@ -11,8 +11,9 @@
 :: http://www.sourceware.org/ml/xsl-list/2002-03/msg00838.html
 
+:: xsd input file and setName of mds file for output
 set xsd=%1
 set mds=%2
 
-if not exist %1 echo XSD file %1 does not exist.& goto exit
+if not exist %xsd% echo XSD file %xsd% does not exist.& goto exit
 
 
@@ -29,5 +30,7 @@
 set xsl=%outputdir%\gli\classes\xml\xsd-to-mds.xsl
 
-:: See http://internal.greenstone.org/wiki/Writing_XSL#Running_ApplyXSLT_to_apply_an_XSLT_file_from_the_command_line
+if not exist %xsl% echo XSLT file %xsl% can't be found.& goto exit
+
+:: See internal wiki page Writing_XSL#Running_ApplyXSLT_to_apply_an_XSLT_file_from_the_command_line
 set xcmd=java -cp "%GSDLHOME%/bin/java/xalan.jar";"%GSDLHOME%/bin/java/ApplyXSLT.jar";"%GSDLHOME%/bin/java/." org.nzdl.gsdl.ApplyXSLT -t "%xsl%" -x "%xsd%" -o "%outputfile%"
 
@@ -45,5 +48,7 @@
 
 :usage
+echo.
 echo Run as %0 ^<xsd file^> ^<namespace^> ^<setname (mds file name)^>
+echo.
 :: E.g. xsd_to_mds.bat C:\<full-path>\CDWALite-xsd-public-v1-1.xsd cdwalite CDWALite
 
