Script that takes strings as input


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script that takes strings as input
# 1  
Old 08-01-2011
Script that takes strings as input

Hello all!

I need to take a series of inputs passed to one shell script and pass them to a second shell script.

For example, the first shell script, script_one.sh, has the following inputs:

Code:
./script_one -u username -p password -option1 string1 -option2 -string2 ....

Inside of script_one.sh I want to pass script_two.sh the same inputs as shown below...

Code:
./script_two -u username -p password -option1 string1 -option2 -string2 ....

However, I do not know all of the inputs nor what order they are in. I simply want to take what is passed to script_one and pass it to script_two possibly in the form of a string.

Any ideas?

Thanks!

Last edited by bashnewbee; 08-01-2011 at 12:20 PM..
# 2  
Old 08-01-2011
If you meant what I'm thinking of
Simply you can store strings in variables and pass them to any number of scripts using the advantage of the shell replacement

Code:
$> string1=sometxtvalue 
$> string2=sometxtvalue
$> ./script_one -u username -p password -option1 $string1 -option2 -`echo $string2` ....
$> ./script_two -u username -p password -option1 $string1 -option2 -`echo $string2` ....

post here if this doesn't suits your needs
# 3  
Old 08-01-2011
Thanks for trying to help! But the problem is that I don't know what variables are being passed. I just need to take all inputs passed to script_one and pass them to script_two. It needs to be an exact copy of the string and I do not know the number of inputs nor the order.
# 4  
Old 08-01-2011
you can call 2nd script as below from script_one
./script_two $@


doest it help ??

Last edited by Amaravathi; 08-01-2011 at 12:50 PM..
This User Gave Thanks to Amaravathi For This Post:
# 5  
Old 08-01-2011
Perfect! Thanks Amaravathi!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Python or Shell script to Grep strings from input file and output in csv format

Hi Experts, I am writing a python script to grep string from file and display output in csv file as in attached screenshot https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view Input file(result_EPFT_config_device) Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies

2. Shell Programming and Scripting

Script that takes IP address as an Input and deletes 7 lines

I have a flat file that contains a list of IP address following 6 additional lines. I would like to get a help in the following. a shell script that would take ip address or list of ip addresses as input, search one by one the ip address in the file and as soon as it find the exact match it... (12 Replies)
Discussion started by: knijjar
12 Replies

3. Shell Programming and Scripting

create an array which can store the strings from the user input in shell script

I want to create an array which can store the strings from the user input in shell script . example :- I want to store the 5 fruits name in a single array which the user provides . (1 Reply)
Discussion started by: Pkast
1 Replies

4. Shell Programming and Scripting

Need help to run sql query from a script..which takes input from a file

I need to run sql script from shell script which takes the input from a file and contents of file will be like : 12345 34567 78657 and query will be like : select seq_nbr from bus_event where event_nbr='12345'; select seq_nbr from bus_event where event_nbr='34567'; select seq_nbr... (1 Reply)
Discussion started by: rkrish
1 Replies

5. Programming

My exe takes more time for specied input

My application is coded in C++ and uses pro C to get data from oracle database. My executable file is taking more time to execute for some specified input. Is there any way to check where it spends the maximum time? (1 Reply)
Discussion started by: SamRoj
1 Replies

6. UNIX for Dummies Questions & Answers

script takes the whole filename instead of just extension

I am running my script from "/abc/" this path and it has no ".csv files" but has a ".txt" files namely temp1.txt My script goes as below, wherein it is suppose to find files with *.txt extension and *.csv extension in another path namely "/abc/xyz/": #!/bin/ksh PATH1="/abc/xyz/" value="*.csv... (1 Reply)
Discussion started by: wolverine999
1 Replies

7. Shell Programming and Scripting

Script that takes in variables, and outputs to another text or script file

Ok, I sort of need to create a command files that will be ftped to another server to run. I have some input variable that will need to be read, and then transformed into another script file. Here are some examples. Server 1: outputCmd.sh passing in ./outputCmd.sh nh8oaxt Release_4_0... (1 Reply)
Discussion started by: orozcom
1 Replies

8. Shell Programming and Scripting

need inputs on how i can change my script to reduce amount of time the script takes

HI , I have a list1 which consists of data that i have to search and a list2 which has the files that need to be searched .So basically i am using list1 on list2 to see if list1 data is present if found replace it .I have written the code using foreach loop for each list .This is taking the... (1 Reply)
Discussion started by: madhul2002
1 Replies

9. Shell Programming and Scripting

script takes params

i want to write a shell script that can be run as ./deployPortal.sh -version 5.1.2 -portlet -exportall how can i do that? version param is required. bu the others are optional. in first step i only want to read 5.1.2, is portlet selected ? and is exportall selected ?? can you... (2 Replies)
Discussion started by: keromotti
2 Replies

10. Shell Programming and Scripting

odd behaviour with quoted input strings

I'm working with a java-based monitoring tool (Solaris/x86) which can be configured to call a shell script when a particular event occurs. The java app sends a set of quoted strings as input to the shell script. The problem I'm running into is that the shell script, when called by the java app,... (0 Replies)
Discussion started by: iron_horse
0 Replies
Login or Register to Ask a Question