New answers tagged arguments
1
vote
grep exact process name in bash script with variable argument
In shells that support it, you could use the substring expansion to put the brackets in the right places:
name=ffmpeg
ps -ef | grep "[${name:0:1}]${name:1}"
would run grep "[f]fmpeg&...
- 128k
0
votes
grep exact process name in bash script with variable argument
Would inverted-match with grep work?
grep -v 'grep\|script'
This will not match grep or script.
3
votes
Accepted
grep exact process name in bash script with variable argument
Simply run:
pgrep -fl script.sh
From man pgrep:
pgrep, pkill, pidwait - look up, signal, or wait for processes based on name and other attributes
-f, --full
The pattern is normally only ...
- 29.2k
1
vote
Passing named arguments to shell scripts
I want the script to function consistently with other utilities, providing the least surprise to the user. Here is what I came up with, combining several ideas here (especially the answer from cdmo) ...
- 361
Top 50 recent answers are included
Related Tags
arguments × 510bash × 239
shell-script × 130
shell × 98
command-line × 64
function × 36
scripting × 34
quoting × 31
linux × 27
options × 19
xargs × 18
find × 17
variable × 17
parameter × 17
files × 15
pipe × 15
command × 15
zsh × 13
array × 13
getopts × 13
posix × 11
grep × 10
io-redirection × 10
wildcards × 10
regular-expression × 9