Pass two parameters

 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support Pass two parameters
# 1  
Old 06-27-2011
Pass two parameters

Hi I have a batch file aaa.exe which needs two input parameters:
Usually the command's format likes
Code:
aaa 555 10000

But I want to use parameters to do it.
Code:
aaa $1 $2

These two parameters come from a text file list.txt
Code:
41800497	41801375
41814783	41816135
41814930	41816135
41819987	41820843
41819987	41820914
41823969	41824906

I need a script to do it.

Thanks for help.
# 2  
Old 06-27-2011
What platform do you use? Cygwin?
Code:
while read -r a b; do
  aaa.exe "$a" "$b"
done < list.txt

# 3  
Old 06-27-2011
Linux: Fedora
# 4  
Old 06-28-2011
If you have a bash script in aaa.exe
Code:
awk '{ print "aaa.exe", $1, $2 }' list.txt | sh

# 5  
Old 06-30-2011
Code:
while read first second
do
aaa $first $second
done

For understanding :

Code:
 
$cat test 
a        b
c        d

 
$while read first second ; do echo $first ; done < test
a
c

$while read first second ; do echo $second; done < test
b
d

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

To invoke pass parameters in Oracle file

Hi Guys, I am having a sql script file which does below operations ALTER TABLE M1 EXCHANGE PARTITION FOR (TO_DATE('&1','dd-MON-yyyy')) WITH TABLE &2 INCLUDING INDEXES; i need to pass variables in such a way that if i pass start date and end date as parameter , something like my... (2 Replies)
Discussion started by: rohit_shinez
2 Replies

2. Shell Programming and Scripting

Pass Parameters to awk command

I need to pass values at runtime for the below awk command where l is the length and partial.txt is the file name. awk -v l=285 '{s="%-"l"s\n";printf(s,$0);}' partial.txt > temp1.txt; (5 Replies)
Discussion started by: Amrutha24
5 Replies

3. Shell Programming and Scripting

pass shell parameters to awk does not work

Why does this work for myfile in `find . -name "R*VER" -mtime +1` do SHELLVAR=`grep ^err $myfile || echo "No error"` ECHO $SHELLVAR done and outputs No error err ->BIST Login Fail 3922 err No error err ->IR Remote Key 1 3310 err But... (2 Replies)
Discussion started by: alan
2 Replies

4. Shell Programming and Scripting

Can't get shell parameters to pass properly to sqlplus

Gurus, The issue I'm having is that my Shell won't accept SQL parameters properly...... Here's they way I'm running it.... applmgr@ga006hds => sh CW_MigrationDeployScript.sh apps <appspwd> <SID> '01-JAN' '31-MAR' The process just hangs not submitting the SQL job... ... (3 Replies)
Discussion started by: WhoDatWhoDer
3 Replies

5. Shell Programming and Scripting

pass parameters from perl to csh scripts

I use csh a lot but I don't really write csh scripts. Now I have a need to implement a security check (written in perl; verify an user input security code) into a csh script. Here is the senario: #csh 1. call the perl script 2. if the perl script returns 'true', pass on; if the perl... (1 Reply)
Discussion started by: Julian16
1 Replies

6. Shell Programming and Scripting

Pass parameters to function

Hi, for example I have this function: function get_param () { test=echo "some string" test2=echo "someother string" } I want to call this function and get test or test2 result, how do I do that ? Thank you (2 Replies)
Discussion started by: ktm
2 Replies

7. Shell Programming and Scripting

How to pass parameters transparently into a sub script

Hi, I am trying to write a script like this: #!/bin/ksh #script name: msgflow #The awk commands for Solaris and Linux are incompatible if ] then msgflow-solaris $* elif ] then msgflow-linux $* fi This script is shared by a file system which is visible to both... (3 Replies)
Discussion started by: danielnpu
3 Replies

8. Shell Programming and Scripting

How to pass parameters to an awk file?

I have an awk file where I need to pass a filename and a value as a parameter from a sh script. I need to know how to pass those values in the sh script and how to use the same in the awk file. Thanks in advance!!! Geetha (3 Replies)
Discussion started by: iamgeethuj
3 Replies

9. UNIX for Dummies Questions & Answers

How to pass two or more parameters to the main in shell script

Hey Guys from the below script what I understood is we are sending the the first parameter as input to the main (){} file main > $LOGFILE 2>&1 but can we send two or three parameter as input to this main file as main > $LOGFILE 2>&1 2>&2 like this Can any one plz help I need to writ a... (0 Replies)
Discussion started by: pinky
0 Replies

10. Shell Programming and Scripting

How to pass Shell variables to sqlplus use them as parameters

Hi, I am trying to pass some of the variables in my shell scripts to the sqlplus call and use them as parameters. For example, I would like to replace the 'SAS', and '20050612' with $var1 and $var2, respectively, how can I do that? --------------------------------------------------------... (1 Reply)
Discussion started by: Jtrinh
1 Replies
Login or Register to Ask a Question