[C SHELL] How to pass dynamic number of arguments


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [C SHELL] How to pass dynamic number of arguments
# 1  
Old 07-24-2011
[C SHELL] How to pass dynamic number of arguments

I have a task. The scenario is like this. I have a operation program (OPR1) , whose function is to simply double the (single)value it receives as input.
I have to write a script to operate the OPR1 and save its output in a file.

Later, I have to modify the script so as to be able to operate OPR1-OPR5, where OPR1 receives single value as input,OPR2 receives two values as input, OPR3 receives three values as input and so on.

I must tell that this is not the exact problem statement at my hand, but a bit complex than the problem statement listed above.(Please prompt me if it is not clear). I have just learnt the basics, hence just request you to help me learn by example.

I request you to :

1) Please provide me a code for the problem statement above.
2) Direct me to study material/ source where i can find numerous Cshell examples to learn how to apply the basics.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to pass arguments while running a Shell Script

Shell Script Gurus, I am writing a shell script which needs User ID's to pass as an Arguments in command line while executing. Can this be doable? I've never done this, If you give a sample script that would be helpful, Thanks. (1 Reply)
Discussion started by: shekar777
1 Replies

2. Shell Programming and Scripting

Pass Arguments to Command from Shell Script

Hi all, I am working on a project, in which I have to connect to Bluetooth low energy device. I am able to connect and do data transfer from command line. But I want to do from script Here is my script #!/bin/bash #sudo hcitool -i hci0 lescan sleep 1 sudo hcitool -i hci0 lecc --random... (8 Replies)
Discussion started by: nithin@embdes
8 Replies

3. Shell Programming and Scripting

How to pass arguments from a textbox in CGI to a shell script?

Hello All, Could you please help me to explain that how do I pass textboxes values while running a shell script which need some arguments while running it and should be invoked after the button click. Here is an example. The first CGI is: #!/bin/ksh echo "Content-Type: text/html"... (4 Replies)
Discussion started by: RavinderSingh13
4 Replies

4. Shell Programming and Scripting

Need to pass shell arguments into Nawk/awk

Hi, I am in critical need of help, Thanks a ton for your help. I need to know how to pass the shell argument into nawk code in AIX. so that my file gets passed into that awk script and it can execute it part. To be detail, i have more than 100 files and in those files a particular field... (6 Replies)
Discussion started by: Selva_2507
6 Replies

5. Programming

How to pass the command line arguments to the shell script in c language?

hi, I am new in the shell script, and c programming with linux. I am looking to pass the arguments in c program that should be executed by the shell script. e.g. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv) { int i; for (i=1;i<argc; i++) { ... (2 Replies)
Discussion started by: sharlin
2 Replies

6. Shell Programming and Scripting

How to pass different number of arguments in a single shot

I have one configuration file. The number of lines in the file will vary. I need to pass each line as a parameter to a shell script in a single shot. Ex: Suppose file contains: ou=x,o=z o=y Suppose the shell script name is sample.sh. Then the script should be called like sample.sh ou=x.o=z... (6 Replies)
Discussion started by: saurabhkoar
6 Replies

7. Shell Programming and Scripting

How to pass arguments to SQL file passed in shell script?

Hi, I am using SYBASE database. in my script i am connecting to DB via using isql. isql -U${S_USER} -S${S_SERV} -D${S_DB} -P${S_PWD} -b0 -w3000 -h0 -s"|" -i${MYDIR}/ABC.sql -oXYZ.txt << FINSQL i am taking a ABC.sql file to use the queries written in it and storing the output in... (3 Replies)
Discussion started by: dazdseg
3 Replies

8. Shell Programming and Scripting

Need help to pass arguments to shell script

Hi, I have a shell script called ftp.sh which is running continously in background. I tried passing arguments to this script but it did not worked out. Below is ftp.sh script. Please help me case $param in start) sleep_func "300" echo "!ksh $scr_ddir/ftp.sh... (1 Reply)
Discussion started by: bhargav20
1 Replies

9. Shell Programming and Scripting

read number of arguments in c shell

I am writing script in c shell and using this script to read the command line arguments, but it is not working. Pl. someone let me know what is the problem. #!/bin/csh -f if ($#argv <> 2) then echo "you must give exactly two parameters" else set name1 = $argv ... (1 Reply)
Discussion started by: skumar11
1 Replies

10. Shell Programming and Scripting

How to pass arguments to a function in a shell script?

Hi, I have two shell variables $t1 and $t2 which I need to pass to a function in a shell script. The function will do some computation with those two variables and echo the resultant. But I do not know how to pass teh arguments. The function written is f1() {...... ........ } What should... (3 Replies)
Discussion started by: preetikate
3 Replies
Login or Register to Ask a Question
SLAPD-SHELL(5)                                                  File Formats Manual                                                 SLAPD-SHELL(5)

NAME
slapd-shell - Shell backend to slapd SYNOPSIS
/etc/ldap/slapd.conf DESCRIPTION
The Shell backend to slapd(8) executes external programs to implement operations, and is designed to make it easy to tie an existing data- base to the slapd front-end. This backend is primarily intended to be used in prototypes. WARNING
The abandon shell command has been removed since OpenLDAP 2.1. CONFIGURATION
These slapd.conf options apply to the SHELL backend database. That is, they must follow a "database shell" line and come before any subse- quent "backend" or "database" lines. Other database options are described in the slapd.conf(5) manual page. These options specify the pathname and arguments of the program to execute in response to the given LDAP operation. Each option is fol- lowed by the input lines that the program receives: add <pathname> <argument>... ADD msgid: <message id> <repeat { "suffix:" <database suffix DN> }> <entry in LDIF format> bind <pathname> <argument>... BIND msgid: <message id> <repeat { "suffix:" <database suffix DN> }> dn: <DN> method: <method number> credlen: <length of <credentials>> cred: <credentials> compare <pathname> <argument>... COMPARE msgid: <message id> <repeat { "suffix:" <database suffix DN> }> dn: <DN> <attribute>: <value> delete <pathname> <argument>... DELETE msgid: <message id> <repeat { "suffix:" <database suffix DN> }> dn: <DN> modify <pathname> <argument>... MODIFY msgid: <message id> <repeat { "suffix:" <database suffix DN> }> dn: <DN> <repeat { <"add"/"delete"/"replace">: <attribute> <repeat { <attribute>: <value> }> - }> modrdn <pathname> <argument>... MODRDN msgid: <message id> <repeat { "suffix:" <database suffix DN> }> dn: <DN> newrdn: <new RDN> deleteoldrdn: <0 or 1> <if new superior is specified: "newSuperior: <DN>"> search <pathname> <argument>... SEARCH msgid: <message id> <repeat { "suffix:" <database suffix DN> }> base: <base DN> scope: <0-2, see ldap.h> deref: <0-3, see ldap.h> sizelimit: <size limit> timelimit: <time limit> filter: <filter> attrsonly: <0 or 1> attrs: <"all" or space-separated attribute list> unbind <pathname> <argument>... UNBIND msgid: <message id> <repeat { "suffix:" <database suffix DN> }> dn: <bound DN> Note that you need only supply configuration lines for those commands you want the backend to handle. Operations for which a command is not supplied will be refused with an "unwilling to perform" error. The search command should output the entries in LDIF format, each entry followed by a blank line, and after these the RESULT below. All commands except unbind should then output: RESULT code: <integer> matched: <matched DN> info: <text> where only the RESULT line is mandatory. Lines starting with `#' or `DEBUG:' are ignored. ACCESS CONTROL
The shell backend does not honor all ACL semantics as described in slapd.access(5). In general, access to objects is checked by using a dummy object that contains only the DN, so access rules that rely on the contents of the object are not honored. In detail: The add operation does not require write (=w) access to the children pseudo-attribute of the parent entry. The bind operation requires auth (=x) access to the entry pseudo-attribute of the entry whose identity is being assessed; auth (=x) access to the credentials is not checked, but rather delegated to the underlying shell script. The compare operation requires read (=r) access (FIXME: wouldn't compare (=c) be a more appropriate choice?) to the entry pseudo-attribute of the object whose value is being asserted; compare (=c) access to the attribute whose value is being asserted is not checked. The delete operation does not require write (=w) access to the children pseudo-attribute of the parent entry. The modify operation requires write (=w) access to the entry pseudo-attribute; write (=w) access to the specific attributes that are modi- fied is not checked. The modrdn operation does not require write (=w) access to the children pseudo-attribute of the parent entry, nor to that of the new par- ent, if different; write (=w) access to the distinguished values of the naming attributes is not checked. The search operation does not require search (=s) access to the entry pseudo_attribute of the searchBase; search (=s) access to the attributes and values used in the filter is not checked. EXAMPLE
There is an example search script in the slapd/back-shell/ directory in the OpenLDAP source tree. LIMITATIONS
The shell backend does not support threaded environments. When using the shell backend, slapd(8) should be built --without-threads. FILES
/etc/ldap/slapd.conf default slapd configuration file SEE ALSO
slapd.conf(5), slapd(8), sh(1). OpenLDAP 2012/04/23 SLAPD-SHELL(5)