Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Converting DOS batch file to UNIX script

RE: Converting DOS batch file to UNIX script

From: Sam Bootsma <SamB_at_cpas.com>
Date: Tue, 20 Feb 2001 08:13:03 -0800
Message-ID: <F001.002B8A3B.20010220071052@fatcity.com>

Thanks to everybody for your assistance. I have passed this info on to some of our programmers that have UNIX clients.

I have also learned a couple basics about UNIX, like Bourne Shell Script is the standard scripting language on UNIX.

Sam.

-----Original Message-----
[mailto:Andreas.Haunschmidt_at_voest.co.at] Sent: February 19, 2001 1:21 PM
To: Multiple recipients of list ORACLE-L

     DOS:
> -------snip-------
> @ECHO OFF
> ECHO ³ To run this installation please type (at the CD-ROM
> prompt)
> ³
> IF "==%1" GOTO NODRIVE
> CD\
> MKDIR %1:\DB543
> COPY \SERVER\SCRIPTS\Install.bat %1:\DB543\SERVER\SCRIPTS\Install.bat
> >NUL:
> :NODRIVE
> REM this is a remark
> call %1:\DB543\SERVER\Scripts\Install.bat parm1 parm2 parm3
>
> sqlplus system/manager_at_db
> -------snip-------
>

    UNIX:
> -------snip-------

    #!/bin/sh
    # This is a comment, the 1st line above is a special comment: 
    # it tells UNIX to invoke /bin/sh (the standard command interpreter 
    # for scripts to process this script

    # adjust your PATH to your needs
    PATH=/bin:/usr/bin:$ORACLE_HOME/bin:     # export your PATH into the environment     export PATH

    # no need for echo off, this is kind of default     echo "To run this installation please type (at the CD-ROM prompt)"

        # UNIX has no drive letters, all drives ( if mounted ) should be accessible under the directory '/', the root directory     

    if [ "X$1" != "X" ] then

        # 1st parameter ( $1 ) is not empty, I suppose $1 should contain the
      # base directory of your stuff
      
      # note: put white space between 'cd' and the directory name
      cd /
              
              # cp does not create directories, you have to create them
yourself
              mkdir  $1/DB543/
              mkdir  $1/DB543/SERVER
              mkdir  $1/DB543/SERVER/SCRIPTS

           cp /SERVER/SCRIPTS/Install.bat
/$1/DB543/SERVER/SCRIPTS/Install.bat
      # output redirect  >NUL would be in UNIX: >/dev/null
      # but cp won't give any messages except an error occurred
      # so we can omit this
            

    fi
    # note: 'fi' means end if     

         $1/DB543/SERVER/Scripts/Install.bat $parm1 $parm2 $parm3

         sqlplus system/manager_at_db
          -------snip-------

Just a few notes:
        This is just a try to "translate your DOS Batch file"
        Be sure to make your scripts executable:
                   chmod +x yourscript and
                   chmod +x $1/DB543/SERVER/Scripts/Install.bat 
        In Unix there is also no need to call a script '.BAT'. You can
simply call it 'install' or
        if you like to 'install.sh' to indicate that is is a Bourne Shell
Script (standard scripting language on UNIX).
        Unix is case sensitive. 
        I don't know exactly what you are going to do with parm1, so I can't
figure out more...

Hope this helped a bit.

Andreas
> ----------
> Von: Berg, Guy van den[SMTP:Guy.vandenBerg_at_compaq.com]
> Gesendet: Montag, 19. Februar 2001 12:20
> An: Multiple recipients of list ORACLE-L
> Betreff: RE: Converting DOS batch file to UNIX script
>
> Quick point that could cause some problems...REM is NOT rm in unix! Try #
> instead or you could end up with an interesting shell script ;)
>
> Cheers,
> g.
>
> -----Original Message-----
> Sent: 17 February 2001 03:40
> To: Multiple recipients of list ORACLE-L
>
>
> cp, mkdir, cd, echo, rm
> ----- Original Message -----
> To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com>
> Sent: Friday, February 16, 2001 2:02 PM
>
>
> Hello All:
>
> We are a Windows shop developing a software product that runs on an Oracle
> database. Most of our clients also run Oracle on Windows. Recently, a
> couple of our new clients have decided to run our database on a UNIX
> server
> instead of NT server. I do not know what flavour of UNIX our clients
> have.
> I know the slashes go in the other direction in UNIX scripts, but can
> anybody tell me the UNIX equivalent of COPY, MKDIR, CD, ECHO, and REM?
>
> Here are a few lines of the batch file we use to install our product. Can
> anybody help me to convert DOS batch file commands to generic UNIX script
> commands?
>
> -------snip-------
> @ECHO OFF
> ECHO ³ To run this installation please type (at the CD-ROM
> prompt)
> ³
> IF "==%1" GOTO NODRIVE
> CD\
> MKDIR %1:\DB543
> COPY \SERVER\SCRIPTS\Install.bat %1:\DB543\SERVER\SCRIPTS\Install.bat
> >NUL:
> :NODRIVE
> REM this is a remark
> call %1:\DB543\SERVER\Scripts\Install.bat parm1 parm2 parm3
>
> sqlplus system/manager_at_db
> -------snip-------
>
> Thanks for your help.
>
> Sam
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Sam Bootsma
> INET: SamB_at_cpas.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Allan Nelson
> INET: anelson_at_houston.rr.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Berg, Guy van den
> INET: Guy.vandenBerg_at_compaq.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Haunschmidt Andreas VASL/FAS
  INET: Andreas.Haunschmidt_at_voest.co.at

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Sam Bootsma
  INET: SamB_at_cpas.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Feb 20 2001 - 10:13:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US