![]() |
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 |
| What the command to find out the record length of a fixed length file? | tranq01 | UNIX for Dummies Questions & Answers | 9 | 12-04-2008 04:04 PM |
| Debian: New yarssr packages fix arbitrary shell command | iBot | Security Advisories (RSS) | 0 | 01-28-2008 10:20 AM |
| what is the maximum length of th os-command line in Unix. | kumardesai | UNIX for Dummies Questions & Answers | 2 | 11-28-2007 07:37 AM |
| How do you take in variables/parameters from the command line? | avisram | UNIX for Dummies Questions & Answers | 1 | 07-21-2005 09:47 AM |
| passing command line parameters to functions - sh | vino | Shell Programming and Scripting | 5 | 03-05-2005 05:51 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Building command line parameters of arbitrary length
I couldn't find an existing thread that addressed this question, so hopefully this isn't redundant with anything previously posted. Here goes:
I am writing a C-Shell script that runs a program that takes an arbitrary number of parameters: myprog -a file1 \ -b file2 \ -c file3 ... \ -n fileN \ -operation "a+b+c+...+n" The files on which myprog operates are in subdirectories: 01/01.ext, 02/02.ext, ... etc. Since the filenames happen to match the directory names, I would like to be able to pass the script an arbitrary number of directories (in practice, there will be fewer than 26, so there is no concern with running out of "-x" tags). The script would then construct the argument list for myprog so that myscript.sh 01 02 03 ... 12 would expand into: myprog -a 01/01.ext -b 02/02.ext ... -k 11/11.ext -l 12/12.ext \ -operation "a+b+c+...+k+l" Is there a straightforward way to do this? |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|