Help needed passing string to command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed passing string to command
# 1  
Old 02-11-2009
Help needed passing string to command

hi to all

code:
</div>
command... "command_name arg1 arg2 option=xxxxx"
example --- useradd username group=xxxxxx.
</div>

when someone ran this command it point to some other script (say script1), mean post execution of command.

in the script1 i need only "xxxxx" value. then i differentiate using case statement.
anyone have idea how to pass value to the script.

thanks
# 2  
Old 02-17-2009
I renamed the subject, but I have no idea what you are asking. Can you please re-phrase your question?
# 3  
Old 02-20-2009
hi to all

the below is the command..........
# nu user=xxx os=unix pgroup=xxxxx

i used below line to get the pgroup name.
--> PGRP=$(echo "$@" |cut -f2 -d'=')


if the user use the pgroup option the above syntax works fine.
if the user don't use the pgroup option the above syntax is failing.
if they don't use the pgroup option it should go to default set.

any suggestions....

thanks
# 4  
Old 02-21-2009
Are you writing the "nu" script? And you are trying to figure out how to handle default arguments? is that correct?
# 5  
Old 02-23-2009
hi

nu is the command in security application side.
they are the only ones to create the users.

any suggestions...

thanks
# 6  
Old 02-23-2009
Well, I still don't understand your question. Are you trying to write a "wrapper" script for nu? A script that will invoke nu, but simplified so that your wrapper script takes 1,2, or 3 arguments, and they are passed onto nu if supplied, but if one is not supplied, than a default is used?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Day in string

I need to pass days in past 3, 4, 5 day in strings. Today is Feb 7, so past 3, 4, 5 days are: day1="Feb 2" day2="Feb 3" day3="Feb 4" I have set day1 day2 day3 as the variables. So, what I need is to have the day stings to be past 3, 4, 5 days every day. If it Feb 8, they need to... (11 Replies)
Discussion started by: danielshell
11 Replies

2. Shell Programming and Scripting

How to avoid "Too many arguments" error, when passing a long String literal as input to a command?

Hi, I am using awk here. Inside an awk script, I have a variable which contains a very long XML data in string format (500kb). I want to pass this data (as argument) to curl command using system function. But getting Too many arguments error due to length of string data(payloadBlock). I... (4 Replies)
Discussion started by: cool.aquarian
4 Replies

3. Shell Programming and Scripting

Help with Passing the Output of grep to sed command - to find and replace a string in a file.

I have a file example.txt as follows :SomeTextGoesHere $$TODAY_DT=20140818 $$TODAY_DT=20140818 $$TODAY_DT=20140818I need to automatically update the date (20140818) in the above file, by getting the new date as argument, using a shell script. (It would even be better if I could pass... (5 Replies)
Discussion started by: SriRamKrish
5 Replies

4. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Help needed to have changing value to the command prompt string variable PS1

Hi, I am using git bash terminal window to do git operations. I have set the prompt string variable PS1 in the ~/.bashrc file as follows: export PS1=" " This is intended to show me the current git branch's name which is active as part of the prompt string. But, the problem is when I do a git... (2 Replies)
Discussion started by: royalibrahim
2 Replies

6. Homework & Coursework Questions

passing letters from an array into a string for string comparison

attempting the hangman program. This was an optional assignment from the professor. I have completed the logical coding, debugging now. ##I have an array $wordString that initializes to a string of dashes ##reflecting the number of letters in $theWord ##every time the user enters a (valid)... (5 Replies)
Discussion started by: lotsofideas
5 Replies

7. Shell Programming and Scripting

Reading a string and passing passing arguments to a while loop

I have an for loop that reads the following file cat param.cfg val1:env1:opt1 val2:env2:opt2 val3:env3:opt3 val4:env4:opt4 . . The for loop extracts the each line of the file so that at any one point, the value of i is val1:env1:opt1 etc... I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies

8. Shell Programming and Scripting

Passing string variables

HI all, Very new to shell programming and just wanted some help on how to solve the following problem. I have a small shell script which searches a given file and extracts some string parameters. I want to now be able to call this script from another shell script and somehow pass the parameters... (11 Replies)
Discussion started by: pxy2d1
11 Replies

9. Solaris

Advice on passing SCSA exam needed

I was hired by a company, and part of the agreement is that I complete the first exam for SCSA Solaris 10 within 60 days, and that I complete the second exam 60 days after that. Other than a book off of amazon, and downloading e-exams online does anyone have any suggestions? (2 Replies)
Discussion started by: brianbullard
2 Replies

10. Shell Programming and Scripting

Passing string from function with '*'

Hi I have a shell function which returns string(ksh). The string is an sql statement. This statement can have '*' in its content (i.e. select 100 / 2 *100 from dual). When this happens ret_str will have contents of current directry I run the script from build in sql. Is there any way to fix it... (2 Replies)
Discussion started by: zam
2 Replies
Login or Register to Ask a Question