![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accessing variables of one shell script in another shell script | rsendhilmani | Shell Programming and Scripting | 2 | 03-17-2009 01:17 AM |
| Accessing PL/SQL OUT variables in Korn Shell Script | bright_future | UNIX for Advanced & Expert Users | 4 | 12-02-2008 12:02 PM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| Accessing var from .profile into shell script | videsh77 | Shell Programming and Scripting | 7 | 05-28-2005 12:21 PM |
| Accessing the home directory in shell script | krishan | SUN Solaris | 1 | 05-21-2005 12:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Accessing the parameters of a shell script
Hi,
I have one situation. I am developing a shell script to which parameters will be passed from a Web based User Interface using some Business Process(BP).There are some 6 parameters for which user will enter the values in UI. These values will be passed to script by BP in the form - <parameter_name>, <value>. Out of 6, atleast one parameter is Mandatory to enter. My difficulty is how to access these parameter values. I thought of something like this. -- If [[echo $* | cut -f1 -d, == "PLANT"]]; then PLANT=`echo $* | cut -f2 -d , ` fi If [[echo $* | cut -f1 -d, == "DIRECTION"]]; then DIRECTION=`echo $* | cut -f2 -d , ` fi But, here my doubt is after the script identified that the string before (,) in any one parameter is PLANT, how is it going to identify the value after that comma & store in variable PLANT. It might also happen that it may take value in any other parameter after comma & store in PLANT variable as '$*' implies any parameter passed to the script. I am not able to understand what logic to implement. Please help. |
|
||||
|
Can you please elaborete further ?
My requirement is like - if I find the string "PLANT" in one of the parameters which is coming in the format as - PLANT,<value> then I should take the <value> ( which is coming immediately after PLANT string with (,) as delimiter between them ) & store it in one variable known as PLANT. It seems simple but due to the problem which I specified above , it will definitely fail. So, I need to implement some different logic. If you think getopts will work in this case, can you please explain with example ? Thanks. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|