LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2010, 03:35 PM   #1
spiderdog
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Rep: Reputation: 0
Convert DOS bat file to shell script


Hello all,

I need to convert the following .bat file to a linux shell script. I would appreciate help from experienced and kind linux folks:

:: Import database schema
echo off
echo.
echo Importing XYZ schema
echo.
IMPDP XYZ/password SCHEMAS=XYZ REMAP_SCHEMA=XYZ:XYZ REMAP_TABLESPACE=XYZ_TBL:XYZ_TBL REMAP_TABLESPACE=XYZ_IDX:XYZ_IDX REMAP_TABLESPACE=XYZ_STG_TBL:XYZ_STG_TBL REMAP_TABLESPACE=XYZ_STG_IDX:XYZ_STG_IDX DUMPFILE=DATA_PUMP_DIR:XYZ.dmp LOGFILE=DATA_PUMP_DIR:XYZ_DATA_PUMP_IMPORT.LOG
:: Display a message about the log file
echo.
echo For details, check the admin\orcl\dpdump\xx_DataPumpImport.LOG files.
echo.
pause
echo on

Thank you
 
Old 06-21-2010, 03:43 PM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Code:
#!/bin/sh
# Import database schema
echo "\nImporting XYZ schema\n"
IMPDP XYZ/password SCHEMAS=XYZ REMAP_SCHEMA=XYZ:XYZ REMAP_TABLESPACE=XYZ_TBL:XYZ_TBL REMAP_TABLESPACE=XYZ_IDX:XYZ_IDX REMAP_TABLESPACE=XYZ_STG_TBL:XYZ_STG_TBL REMAP_TABLESPACE=XYZ_STG_IDX:XYZ_STG_IDX DUMPFILE=DATA_PUMP_DIR:XYZ.dmp LOGFILE=DATA_PUMP_DIR:XYZ_DATA_PUMP_IMPORT.LOG
# Display a message about the log file
echo "\nFor details, check the admin\orcl\dpdump\xx_DataPumpImport.LOG files.\n"
read
The line "#!/bin/sh" tells you which shell should interpret the script. Lines beginning with "#" are comments. The other commands are self-explaining (echo accepts C-style strings, \n = newline; read will read one line/record from the standard input and write it to some variable, if specified).

Maybe you want to try this:
http://www.linuxconfig.org/Bash_scripting_Tutorial

Last edited by irmin; 06-21-2010 at 03:47 PM.
 
Old 06-21-2010, 03:54 PM   #3
spiderdog
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Hello irmin, thank you for the solution. I actually tried to edit / cancel the request in order to try to research further before posting the question, but you were faster and my request wasn't successful, since the thread is still posted. I thank you for your response and link to the tutorial.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to convert a batch file to a shell script webshore Linux - Newbie 2 05-03-2010 08:42 AM
How to invoke a .bat file inside a shell script ???? nano2 Programming 2 07-30-2009 09:36 AM
How to convert a batch file(.bat) to script file(.sh) manas_sem Programming 4 06-28-2007 01:10 PM
Remote Win Bat File execute Shell Script on AIX Server DriveMeCrazy AIX 5 05-26-2004 07:24 PM
how to convert a text file into shell script meng_en Linux - General 9 10-15-2002 11:46 PM


All times are GMT -5. The time now is 07:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration