Sponsored Content
Top Forums Shell Programming and Scripting Processing Multiple Arguments in Command Line Options Post 302829619 by Jay Deshpande on Friday 5th of July 2013 09:52:21 AM
Old 07-05-2013
@zaxxon - It worked partially. I was able to list the arguments passed to -l option.
The only problem was that, these arguments were also passed to the *) option.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to? launch command with string of command line options

my description from another thread... here's my code: #!/bin/bash IFS=$'\n' function OutputName() { input=$1 echo $input input=`echo "$input" | sed -e 's/.//'` input=`echo "$input".avi` output_name=$input } if ]; then echo... (5 Replies)
Discussion started by: TinCanFury
5 Replies

2. Programming

Combining multiple command line arguments

suppose the user enters: ./Myfile blah1 blah2 blah3 I want to be able to read that in as: blah1blah2blah3 IN ONE VARIABLE Obviously I can print it out in one line excluding the white space, but I'm having trouble combining argv, argv, ....., argv together! This is what I tried, but I... (3 Replies)
Discussion started by: hansel13
3 Replies

3. Shell Programming and Scripting

Using perl to get options from command line

Hi all, I want to get options from command line by perl. usage() options: -h Show this help message and exit -t Name of tester --timeout Set the timeout -l ... (1 Reply)
Discussion started by: Damon_Qu
1 Replies

4. Shell Programming and Scripting

find command to use multiple -exec options

Hello All, Is there a way to make exec do a couple of operations on a single input from find? For example, find . -type d -exec ls -l "{}" ";" I would like to give the result of each "ls -l" in the above to a wc. Is that possible? I want to ls -l | wc -l inside exec. How do I... (1 Reply)
Discussion started by: prasanna1157
1 Replies

5. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

6. Shell Programming and Scripting

Shell script to read multiple options from file, line by line

Hi all I have spent half a day trying to create a shell script which reads a configuration file on a line by line basis. The idea of the file is that each will contain server information, such as IP address and various port numbers. The line could also be blank (The file is user created). Here... (1 Reply)
Discussion started by: haggismn
1 Replies

7. Shell Programming and Scripting

[Solved] Sed error - multiple number options to `s' command

Hi All, I am having two files (file1 & file2) and a filelist.txt file below. file1: $$STRINGVAR1=5 $$STRINGVAR2=10 $$LAST_UPD_DT_TBL1=12/12/2010 12:00:00 $$STRINGVAR3=100 $$LAST_UPD_DT_TBL2=01/01/2010 12:00:00... (8 Replies)
Discussion started by: Chandru_Raj
8 Replies

8. UNIX for Dummies Questions & Answers

UNIX find command - using multiple -name options

Hi all, What am trying do is search for a directory that is owned by cm that only exists in a path that has a particular directory ex: what I'm using now is find . -user cm -name '*.rel' -type d -exec ls -dl {} \; This is giving me stuff like this ./../../foo1/../../*.rel... (2 Replies)
Discussion started by: jtmed
2 Replies

9. Shell Programming and Scripting

Command line arguments with multiple values

how can I pass multiple values from command line arguments example script.sh -arg1 op1 -arg2 op1 op2 op3 (2 Replies)
Discussion started by: nsk
2 Replies

10. Shell Programming and Scripting

Multiple search options in find command

Hi, I'd like find multiple file options to fetch different types of files. find /path...// -type f -name "*.log" -o -name "*.req" -o -name "*.txt" -mtime +5 -exec ls -l {} \; Where as in the above command only the last .txt files its retriving but not .log and .req files can body help... (1 Reply)
Discussion started by: Y.balakrishna
1 Replies
FUNC_GET_ARG(3) 							 1							   FUNC_GET_ARG(3)

func_get_arg - Return an item from the argument list

SYNOPSIS
mixed func_get_arg (int $arg_num) DESCRIPTION
Gets the specified argument from a user-defined function's argument list. This function may be used in conjunction with func_get_args(3) and func_num_args(3) to allow user-defined functions to accept variable- length argument lists. PARAMETERS
o $arg_num - The argument offset. Function arguments are counted starting from zero. RETURN VALUES
Returns the specified argument, or FALSE on error. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | This function can now be used in parameter | | | lists. | | | | | 5.3.0 | | | | | | | If this function is called from the outermost | | | scope of a file which has been included by call- | | | ing include(3) or require(3) from within a func- | | | tion in the calling file, it now generates a | | | warning and returns FALSE. | | | | +--------+---------------------------------------------------+ ERRORS
/EXCEPTIONS Generates a warning if called from outside of a user-defined function, or if $arg_num is greater than the number of arguments actually passed. EXAMPLES
Example #1 func_get_arg(3) example <?php function foo() { $numargs = func_num_args(); echo "Number of arguments: $numargs "; if ($numargs >= 2) { echo "Second argument is: " . func_get_arg(1) . " "; } } foo(1, 2, 3); ?> The above example will output: Number of arguments: 3 Second argument is: 2 Example #2 func_get_arg(3) example before and after PHP 5.3 test.php <?php function foo() { include './fga.inc'; } foo('First arg', 'Second arg'); ?> fga.inc <?php $arg = func_get_arg(1); var_export($arg); ?> Output previous to PHP 5.3: Output in PHP 5.3 and later: Warning: func_get_arg(): Called from the global scope - no function context in /home/torben/Desktop/code/ml/fga.inc on line 3 false Example #3 func_get_arg(3) example of byref and byval arguments <?php function byVal($arg) { echo 'As passed : ', var_export(func_get_arg(0)), PHP_EOL; $arg = 'baz'; echo 'After change : ', var_export(func_get_arg(0)), PHP_EOL; } function byRef(&$arg) { echo 'As passed : ', var_export(func_get_arg(0)), PHP_EOL; $arg = 'baz'; echo 'After change : ', var_export(func_get_arg(0)), PHP_EOL; } $arg = 'bar'; byVal($arg); byRef($arg); ?> The above example will output: After change : 'bar' As passed : 'bar' After change : 'baz' NOTES
Note Because this function depends on the current scope to determine parameter details, it cannot be used as a function parameter in ver- sions prior to 5.3.0. If this value must be passed, the results should be assigned to a variable, and that variable should be passed. Note If the arguments are passed by reference, any changes to the arguments will be reflected in the values returned by this function. Note This function returns a copy of the passed arguments only, and does not account for default (non-passed) arguments. SEE ALSO
... syntax in PHP 5.6+, func_get_args(3), func_num_args(3). PHP Documentation Group FUNC_GET_ARG(3)
All times are GMT -4. The time now is 05:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy