The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-19-2007
madhunk madhunk is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 91
Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server

I have a .sh script which was running fine on all the UNIX Servers (AIX, SunSolaris). The script requires two mandatory parameters and many optional parameters. Now at a different client place who are on a Windows Server, when I try to execute the script through MKS Toolkit, there are couple of issues. The script runs very well if I don't provide any optional parameters. I don't understand why the script doesn't treat those as optional parameters. Am I invoking the wrong shell? I tried many options...

Sample script:
Code:
#!/bin/ksh
while getopts :s:u:p:f:m:w:r: Option
do
    case $Option in
        s) Server=$OPTARG;;
        u) User=$OPTARG;;
        p) PassWd=$OPTARG;;
        f) ParmFile=$OPTARG;;
        m) Mode=$OPTARG;;
        w) Warn=$OPTARG;;
        r) Rows=$OPTARG;;
        :) echo "ERROR: Invalid argument. $OPTARG requires a value."
           display_usage;;

        ?) echo "ERROR: Unknown option $OPTARG."
           display_usage;;
    esac
done

shift `expr $OPTIND - 1`
This is how it is executed.

Code:
BatchRun.sh -p <optional> <mandatory> <mandatory>
I tried many ways to give quotes around the optional parameters on the command line. But it doesn't recognize the -p on the command line.

Please advice if somebody had the same issue..