The arguments tag has no wiki summary.
-1
votes
1answer
41 views
Delimiters of program arguments?
What is the syntax to delimit the arguments of a C program.
For example, if I type :
./myprogram 1 2 3 | grep result
The | grep result will be interpreted as arguments (and passed as argv). So how ...
2
votes
3answers
63 views
Passing multiple directories to the -prune option in find
I am using find to locate and delete backup files but wish to exclude certain directories from the search. The backup filenames could terminate in .bck, bak, ~, or backup.
The Minimal Working Example ...
5
votes
2answers
90 views
Bash : command line with optional arguments
I'm running this kind of code:
#!/usr/bin/env bash
set -u
exclude1='--exclude=/path/*'
exclude2='--exclude=/path with spaces/*'
exclude3='' # any 'exclude' can be empty
tar -czf backup.tgz ...
1
vote
2answers
39 views
Key letters? Option letters? What are these things?
Some GNU and GNU-like tools seem to accept options in a combined manner, e.g. foo -hgcf instead of foo -h -g -c -f.
An example is tar, as in tar cXbf keepout 20 archive.shar *.txt instead of tar -c ...
1
vote
1answer
79 views
Why is $* not working as expected?
I'm trying to use $* in a function to expand to all commandline arguments in a function, but it's giving me bizarre behavior:
$ function repeat() {
echo "$*"
}
$ repeat puts hello # this gives me ...
2
votes
2answers
853 views
What's the difference between STDIN and arguments passed to command?
I could use the either form to execute the cat method:
cat file_name
cat < file_name
The result is the same
Then I want to execute man in the format of STDIN
man < file_name
For the ...
3
votes
1answer
45 views
How to put an argument vector with an argument containing spaces in a bash variable
How can I store an argument vector with an argument containing spaces in a bash variable?
For example, I want 2.sh to print b c
1.sh
#!/bin/bash
ARGV='a "b c"'
./2.sh $ARGV
2.sh
#!/bin/bash
...
1
vote
2answers
143 views
Pattern matching from the input arguments
we're trying to enhance the scripts.
Users will pass some arguments and part of the arguments will have 5.0.3 For an example the input argument would be like Jboss5.0.3GA. Since it ( Jboss5.0.3GA ) ...
1
vote
2answers
196 views
Bash script that reads filenames from a pipe or from command line args?
I want my script to read a bunch of filenames (which may have spaces) given either as a glob or from STDIN and do stuff with them. I've been able to read either way separately, but not combine them.
...
1
vote
2answers
107 views
How do I pass the contents of a file as a command line parameter
I am storing a file path in a file and need to pass the contents of that file as an argument to a shell script, specifically Maven, something like so:
mvn -Dvar_name=(contents of file)
Would this ...
2
votes
2answers
180 views
Bash: passing braces as arguments to bash function
I love using the following pattern for searching in files:
grep --color=auto -iRnHr --include={*.js,*.html,} --exclude-dir={release,dev,} "span" .
I'd like, however, to have this one wrapped into a ...
4
votes
2answers
546 views
How to pass arguments to bash shell script when executing that command with at?
I have a shell script that accepts an argument and uses that in the script. So to run the script I type
/path/to/script argument
The problem is when trying to setup that file to run using the at ...
-1
votes
1answer
76 views
Why do many CLI apps take a single “--” argument? [duplicate]
Possible Duplicate:
What does “--” (double-dash) mean?
There are many command line tools that take a single "--" argument. For example:
gem install mysql -- ...
1
vote
1answer
85 views
Redirection doesn't show up as an argument to a sourced script
My problem is that I can't print to the screen when I write a bash script
. myBashScript.sh < text.txt
In myBashScript.sh I just print out
echo $2
But instead of printing "text.txt", it ...
5
votes
2answers
253 views
What is a canonical way to find the actual maximum argument list length?
Following ARG_MAX, maximum length of arguments for a new process it seems like ARG_MAX is wrongly (or at least ambiguously) defined on my Mac Mini 3,1 running Ubuntu 12.04:
$ getconf ARG_MAX # ...

