Sponsored Content
Top Forums Shell Programming and Scripting Batch to shell script conversion Post 302967439 by Chubler_XL on Tuesday 23rd of February 2016 10:47:18 PM
Old 02-23-2016
Pathname separator in unix is slash (/) not backslash (\)
Semicolon is a command separator and needs to be quoted when used in environment variables.

This code:

Code:
export JAVA="$JRE_HOME\bin\java"
export BART_LIB_DIR=$BART_HOME\$BART_VER\lib
export XALAN_LIB=$BART_LIB_DIR\xalan.jar
export COMMONS_LIB=$BART_LIB_DIR\commons-collections-3.2.1.jar;$BART_LIB_DIR\commons-configuration-1.6.jar;$BART_LIB_DIR\commons-lang-2.4.jar;$BART_LIB_DIR\commons-logging-1.1.1.jar;$BART_LIB_DIR\commons-io-1.4.jar;$BART_LIB_DIR\xmlunit-1.2.jar
export BART_LIB=$BART_LIB_DIR\bart.jar
export BART_RULES_LIB=$BART_LIB_DIR\bart-rules.jar
export BART_CP_EXT=$XALAN_LIB;$COMMONS_LIB;$BART_LIB;$BART_RULES_LIB;

Should be :

Code:
export JAVA="$JRE_HOME/bin/java"
export BART_LIB_DIR=$BART_HOME/$BART_VER/lib
export XALAN_LIB=$BART_LIB_DIR/xalan.jar
export COMMONS_LIB="$BART_LIB_DIR/commons-collections-3.2.1.jar;$BART_LIB_DIR/commons-configuration-1.6.jar;$BART_LIB_DIR/commons-lang-2.4.jar;$BART_LIB_DIR/commons-logging-1.1.1.jar;$BART_LIB_DIR/commons-io-1.4.jar;$BART_LIB_DIR/xmlunit-1.2.jar"
export BART_LIB=$BART_LIB_DIR/bart.jar
export BART_RULES_LIB=$BART_LIB_DIR/bart-rules.jar
export BART_CP_EXT="$XALAN_LIB;$COMMONS_LIB;$BART_LIB;$BART_RULES_LIB;"


Code:
:ARGERR 
ECHO Usage : launch "config-filename". Eg. launch bart.cfg 
GOTO END

:ARGERR is a destination for an earlier GOTO statement.


you would probably have something like this:

Code:
# Test exactly 1 argument passed to program
if [ $# -ne 1 ]
then
   echo "Usage : launch \"config <filename>\". Eg. launch bart.cfg"
   exit 1
fi

...

# Test JAVA exists and is executable
if [ -x "$JAVA" ]
then
    $JAVA -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl \
             -classpath $BART_CP_EXT com.sample.eai.tools.icg.bart.Bart
else
    echo JRE_HOME not set correctly. Unable to locate java.exe
fi

echo "JAVA VALUE: $JAVA"
echo "BART LIB VALUE:  $BART_LIB_DIR"
echo "XALAN_LIB VALUE: $XALAN_LIB"
echo "COMMONS_LIB VALUE: $COMMONS_LIB"
echo "BART_LIB VALUE: $BART_LIB"
echo "BART_RULES_LIB VALUE: $BART_RULES_LIB"
echo "BART_CP_EXT VALUE:  $BART_CP_EXT"


echo "#####BART RUNN STATUS#####"

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

batch command in a shell script

How do I execute a batch command from a script, which "waits" with the next command until the first one has finished? ======= A piece of my script looks like this: #!/bin/sh (...) # run a long batch job: ./run_calculation.sh # then rename resulting file: mv output.dat backup.dat (...) ... (7 Replies)
Discussion started by: ivvo
7 Replies

2. Shell Programming and Scripting

Change the Windows Batch script to UNIX shell script.

Hi, When I run the below script in UNIX it's throwing syntax errors. Actually it's a windows batch script. Could anyone change the below Windows Batch script to UNIX shell script... Script: REM :: File Name : Refresh_OTL.bat REM :: Parameters : %1 - Region REM :: : %2 - Cube Type REM ::... (5 Replies)
Discussion started by: tomailraj
5 Replies

3. Shell Programming and Scripting

Help with 'batch conversion using lame' shell script

Hi. I am trying to write an sh script that will: 1. take each wav file in ~/Documents 2. convert each into mp3 format using "lame" encoder 3. save the new mp3 in ~/Documents/newmp3s. It has to follow the 3 steps in this order for each wav file before taking the next file. I tried a... (8 Replies)
Discussion started by: Kingzy
8 Replies

4. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

5. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

6. Shell Programming and Scripting

Conversion batch shell script

while converting batch file to shell script ...dis command is ther i dunno how to change...can anyone knws how to change into shell script rm !(D:\temp\XX.txt) (3 Replies)
Discussion started by: monisha
3 Replies

7. Shell Programming and Scripting

Batch to bash conversion

Hi, I am just trying to convert the batch script to bash script and i am stuck at one point where I have the below code for /f "delims=" %%a in (a.txt) do ( for /f "tokens=1,2,3* delims==" %%i in ("%%a") do ( for /f "tokens=1,2,3* delims= " %%x in ("%%i") do ( if... (4 Replies)
Discussion started by: prasanna2166
4 Replies

8. Shell Programming and Scripting

Shell script from batch file

Hi, I am a junior dba and started carrier very new. I have a batch file to create some script of db creation. I want that batch file to convert in .sh file so that I can directly run that in the AIX box to generate those files. Please help me with the code for AIX. Batch file is here: ... (2 Replies)
Discussion started by: dba_aix
2 Replies

9. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

10. UNIX for Beginners Questions & Answers

Converting the following batch script to Linux shell

I am currently migrating to ubuntu from my windows system. Now I am learing to convert all my batch scripts into linux shell. Although the common commands are more or less similar, but I found it difficult for the following set of commands in windows cmd: setlocal :PROMPT SET /P... (2 Replies)
Discussion started by: net.genere
2 Replies
NPM-RUN-SCRIPT(1)                                                                                                                NPM-RUN-SCRIPT(1)

NAME
npm-run-script - Run arbitrary package scripts SYNOPSIS
npm run-script <command> [--silent] [-- <args>...] alias: npm run DESCRIPTION
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts. As of ` https://blog.npmjs.org/post/98131109725/npm-2-0-0, you can use custom arguments when executing scripts. The special option -- is used by getopt https://goo.gl/KxMmtG to delimit the end of the options. npm will pass all the arguments after the -- directly to your script: npm run test -- --grep="pattern" The arguments will only be passed to the script specified after npm run and not to any pre or post script. The env script is a special built-in command that can be used to list environment variables that will be available to the script at run- time. If an "env" command is defined in your package, it will take precedence over the built-in. In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write: "scripts": {"test": "tap test/*.js"} instead of "scripts": {"test": "node_modules/.bin/tap test/*.js"} to run your tests. The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of ` https://github.com/npm/npm/releases/tag/v5.1.0 you can customize the shell with the script-shell configuration. Scripts are run from the root of the module, regardless of what your current working directory is when you call npm run. If you want your script to use different behavior based on what subdirectory you're in, you can use the INIT_CWD environment variable, which holds the full path you were in when you ran npm run. npm run sets the NODE environment variable to the node executable with which npm is executed. Also, if the --scripts-prepend-node-path is passed, the directory within which node resides is added to the PATH. If --scripts-prepend-node-path=auto is passed (which has been the default in npm v3), this is only performed when that node executable is not found in the PATH. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in case you've forgotten. You can use the --silent flag to prevent showing npm ERR! output on error. You can use the --if-present flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially undefined scripts without breaking the execution chain. SEE ALSO
o npm help 7 scripts o npm help test o npm help start o npm help restart o npm help stop o npm help 7 config January 2019 NPM-RUN-SCRIPT(1)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy