LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Convert DOS bat file to shell script (https://www.linuxquestions.org/questions/linux-newbie-8/convert-dos-bat-file-to-shell-script-815499/)

spiderdog 06-21-2010 02:35 PM

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

irmin 06-21-2010 02:43 PM

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

spiderdog 06-21-2010 02:54 PM

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.


All times are GMT -5. The time now is 09:23 PM.