New answers tagged variable-substitution
1
vote
Escape a variable for use as content of another script
If you don't want to maintain your own function, you can use shell-quote:
$> shell-quote "single'quote" 'double"quote'
'single'\''quote' 'double"quote'
shell-quote lets you ...
1
vote
Accepted
How do I correctly define and interpolate this variable into my find command?
This is because—since you are quoting the variable, as you should—it is passed aa single string to find. You can see this with set -x:
$ all_exts=" -iname \"*.webm\" -o -iname \"*....
3
votes
defining variables inside function
FILE_CORE_NAME="$(/usr/bin/env basename $(/usr/bin/env awk -F "." '{print $1}' <<< "${FILE_TO_PROCESS}"))"; local FILE_CORE_NAME;
Even when reformatted on ...
2
votes
defining variables inside function
local name=value creates a local variable and set it to value. In your case there is no value so you create a local variable which is empty and the local variable hides the non-local variable with the ...
Top 50 recent answers are included
Related Tags
variable-substitution × 316bash × 177
shell-script × 83
shell × 57
variable × 49
quoting × 24
zsh × 21
command-substitution × 16
sed × 15
wildcards × 15
awk × 13
brace-expansion × 13
string × 12
command-line × 10
scripting × 10
parameter × 10
ksh × 9
array × 8
linux × 7
grep × 7
find × 7
environment-variables × 7
function × 6
arguments × 6
echo × 6