All Questions
5
questions
5
votes
3
answers
1k
views
Find exec sh: Shell variable not getting passed to subshell
Here is a simplified code that prints the name of Directory if it contains a Filename with same name as the parent directory and .md extension.
FIND(){
find . -type d -exec sh -c '
for d ...
3
votes
1
answer
6k
views
Passing arguments with spaces and quotes to a script (without quoting everything)
The following works great on the command-line:
$ ffmpeg -i input.m4a -metadata 'title=Spaces and $pecial char'\''s' output.m4a
How do I parameterize this command and use it in a script/function? I ...
0
votes
2
answers
498
views
bash script function argument problem [duplicate]
Not sure why this is producing error. This is a test code emulating my real code. I want to write a wrapper for find and want to allow for any argument, so I'm wrapping each arg in single quotes.
#...
12
votes
2
answers
23k
views
Pass arguments to function exactly as-is
I have the following function:
bar() { echo $1:$2; }
I am calling this function from another function, foo. foo itself is called as follows:
foo "This is" a test
I want to get the ...
5
votes
2
answers
4k
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 ...