Pass argument in script to run specific part in that


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Pass argument in script to run specific part in that
# 1  
Old 01-29-2014
RedHat Pass argument in script to run specific part in that

Hello Friends,

I need you help !

I have a scripts names runsteps.sh which contains command to run bunch of commands for each application you want to install " Oracle " Jboss" etc

Code:
echo " Which app you want to install Jboss" ? Yes or no? 
read ans

depending on Yes or not it goes inside case statement and run bunch of commands.

What i am looking for ?

When i run the script
Code:
# runsteps -app Jboss [ Should run only Jboss section in script ]
# runsteps -app oracle [ Shoud run only Oracle section in script ]

Pls help.

Last edited by Don Cragun; 01-29-2014 at 06:18 AM.. Reason: Add CODE and ICODE tags.
# 2  
Old 01-29-2014
Ok, fix it.

Seriously you've not shown code. How do we give suggestions?

Have a look at this: How can I handle command-line arguments (options) to my script easily?
# 3  
Old 03-15-2014
Thanks I am good now. How to close the thread ?
# 4  
Old 03-15-2014
You don't. You should post your solution to the problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with the Script to pass stdin in run time

I have put a script inside bash_profile of user "root". That script executes when we do "sudo su -" and prompts with a question : "Why are you logginf as root?" and users have to pass the reason then they get prompt. Inside script we have used "read -p input" to take input from user. I am a... (3 Replies)
Discussion started by: shekhar_4_u
3 Replies

2. Shell Programming and Scripting

How to pass an argument to encrypted script having openssl ?

Hi, can it be possible to pass and argument to an encrypted script? for example.. Say I have this script which takes one input.. > cat aa #!/bin/ksh UNAME=$1 echo "Hi $UNAME.." > aa TEST Hi TEST.. Now I encrypted this code.. (6 Replies)
Discussion started by: akore83
6 Replies

3. Shell Programming and Scripting

How to pass Oracle sql script as argument to UNIX shell script?

Hi all, $ echo $SHELL /bin/bash Requirement - How to pass oracle sql script as argument to unix shell script? $ ./output.sh users.sql Below are the shell scripts and the oracle sql file in the same folder. Shell Script $ cat output.sh #!/bin/bash .... (7 Replies)
Discussion started by: a1_win
7 Replies

4. UNIX for Dummies Questions & Answers

How to pass command line argument in shell script?

I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like invalid option - - should pass the argument. and Exit from the script (8 Replies)
Discussion started by: Nsharma3006
8 Replies

5. Shell Programming and Scripting

How to pass command line argument in shell script?

I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like invalid option - - should pass the argument. and Exit from the script https://www.unix.com/images/misc/progress.gif (1 Reply)
Discussion started by: Nsharma3006
1 Replies

6. Shell Programming and Scripting

Bash- Command run from script does not pass full parameters with spaces inside

There's a JavaScript file that I call from command line (there's a framework) like so: ./RunDiag.js param1:'string one here' param2:'string two here' I have a shell script where I invoke the above command. I can run it in a script as simple as this #!/bin/bash stuff="./RunDiag.js... (4 Replies)
Discussion started by: AcerAspirant
4 Replies

7. Shell Programming and Scripting

How we can pass the argument when calling shell script from perl script

Can someone let me know how could I achieve this In one of per script I am calling the shell script but I need to so one thing that is one shell script call I need to pass pne argument.In below code I am calling my ftp script but here I want to pass one argument so how could I do this (e.g:... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies

8. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

9. Shell Programming and Scripting

Need to pass argument

Hi, I need to pass the argument in my shell script as db_ubackup20111015*.log Scenario: I have backup log file location in /home/backup directory (more than 40 days). I need to check the log file of the latest one (tail . a. How I can retrieve the latest value other than passing... (1 Reply)
Discussion started by: prashanth_gs
1 Replies

10. Shell Programming and Scripting

Need to run the script by argument passing

Hi All, I have a question regarding running this script by passing an argument, for example ./ShellParse.sh sun, how do i do that? So i want when i pass argument sun, it shouild execute things inside the for loop. I want to support some other platforms too, so there are more for loops to... (3 Replies)
Discussion started by: asirohi
3 Replies
Login or Register to Ask a Question