script running by sh but not by bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script running by sh but not by bash
# 1  
Old 05-23-2012
script running by sh but not by bash

execute the attached script as,

Code:
bash -x INFA_MAP_GEN_XML.sh  "/export/home/e120945/INFORMATICA_MAPPING_GENERATOR/SOURCE" "INFA_TEMPLATE.csv" "/export/home/e120945/INFORMATICA_MAPPING_GENERATOR/TARGET" "UNIX" "/export/home/e120945/INFORMATICA_MAPPING_GENERATOR/SETUP" "/export/home/e120945/INFORMATICA_MAPPING_GENERATOR/SETUP/LOGFILE1"  "ISO8859-1"

and there will be error like "FLAG_TRANS_SOURCE_1: integer expression expected"

Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.


# 2  
Old 05-23-2012
Why must you run it with bash if it was made to work in sh? Is it that it won't work on a machine that uses bash as sh? I'd almost want to completely rewrite something like this before feeding it to bash. The amount of evil (i mean eval) used in there, and using cat file | head | tail to grab each line rather than a while read loop... wow.

no one is going to want to maintain something like this.. delete it!

Can you explain the function of this script?
# 3  
Old 05-23-2012
When you post an error message, please post the entire error message.

Please post the last 20 lines of the output from your bash -x .
This should show which line is producing the error.


There are several lines containing -eq -1 which only work in Shells which can deal with negative integer values. I don't know if yours is one of them.
# 4  
Old 05-23-2012
it is an old script, just need it to run on Bash successfully.

the only error i am getting is "INFA_MAP_GEN_XML.sh: line 1117: [: FLAG_TRANS_SOURCE_1: integer expression expected".

pls. let me know if it can be rectified.
# 5  
Old 05-23-2012
PFA the output that I get.
# 6  
Old 05-23-2012
There are 375 "integer expression expected" errors in your sample bash log with 51 different variations.
That error message usually comes from the expr command but the log suggests that it is coming from if statements.

The script is virtually impossible to follow due to the use of eval commands, and made even more complicated by the use of functions (which may well behave differently in bash).

Short of a total rewrite, all I can suggest is testing line-by-line until the bad construct (or constructs) come to light.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running nmap via bash script

Hello fellow scripters... I am trying to set up a script for work that reads the contents of a file of IP address and network names, takes these and runs a given nmap scan against them and then saves the output to a file with the filename of the network name. Such as... IP file looks like... (4 Replies)
Discussion started by: hawkeyesc72
4 Replies

2. Shell Programming and Scripting

Running options in bash script

Hello UNIX & Linux Forums community! Long time Linux daily user hobbyist, new to shell scripting.... I'm working on a script that does all the "work" in one script, and makes calls to a second script to display info to the user via mostly expanding variables in heredocs. I'm contemplating... (6 Replies)
Discussion started by: Cody Learner
6 Replies

3. UNIX for Dummies Questions & Answers

Running a C/C++ program and/or bash script from a server

I wish to be able to give to a client the opportunity to : 0) Turn one of my ubuntu computers into a webserver 1) See a webpage after visiting a url where an external user/client can set a couple of variables (e.g. Number1= ?, Number2=?) 2) By pressing "run" the program runs on my machine 3)... (1 Reply)
Discussion started by: frad
1 Replies

4. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

5. UNIX for Dummies Questions & Answers

Help Running a Check in Bash Script

Hey guys, so I wrote a small script that pretty much just takes in two numbers and counts from the first to the second, e.g. unknown-hacker|544> count.sh 1 3 1 2 3 My problem is I want to make it so that if you input invalid parameters, such as non-numerical characters, more than 2... (2 Replies)
Discussion started by: Duo11
2 Replies

6. UNIX for Dummies Questions & Answers

Running Executable in Bash Script

Hey guys, so I've been trying to write a bash script called runSorter.sh that runs an executable that also takes in some parameters and outputs the results to a text file. The executable, sorter, takes in a number parameter. I want to make it so that you can input as many number parameters into... (4 Replies)
Discussion started by: Duo11
4 Replies

7. Shell Programming and Scripting

Validate BASH script before running it...

Hello, Is there some way to validate a bash script before running it. I want to make sure all of the syntax and everything is good so that I dont get a false return code. Thanks, tom (7 Replies)
Discussion started by: tjones1105
7 Replies

8. Shell Programming and Scripting

Script running in bash 3.0 not in 3.2

I have wasted one working day writing this scripts. It compares two folders and make a good tabbed report about their differences. #!/bin/bash function DRAW_DEPTH () { ROUND=$1 while do printf %s " " ROUND=`expr $ROUND - 1` done printf %s "|- " } function MAIN () {... (9 Replies)
Discussion started by: trutoman
9 Replies

9. UNIX for Advanced & Expert Users

debugging an already running bash script

# ps -ef | grep rc root 13903 1 0 08:56 ? 00:00:00 /usr/sbin/automount --timeout=60 /archive file /etc/auto_archive root 10706 1 0 08:55 ? 00:00:00 /bin/bash /etc/rc.d/rc 3 root 2933 20071 0 19:38 pts/1 00:00:00 grep rc Is there any way to debug the... (1 Reply)
Discussion started by: marcpascual
1 Replies

10. Linux

Cannot running export database using bash script

Hi all, I'm new in linux. When I try to run a bash script, it doesn't execute and i receive the following error message 20070321:220002|ERROR||exportDatabase.bash|Another EXPORT process (pid=2799) is still running. If i kill this pid, i receive "No such process". This process was running... (5 Replies)
Discussion started by: tovohery
5 Replies
Login or Register to Ask a Question