bad substitution running $ls ⦠with bash
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I got the following error:
./assemblyDB.116.las
test.sh: line 9: $ sed 's/.las//': bad substitution
and this is the script:
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$ sed 's/.las//'
echo $no
done
Thank you in advance.
bash
add a comment |Â
up vote
5
down vote
favorite
I got the following error:
./assemblyDB.116.las
test.sh: line 9: $ sed 's/.las//': bad substitution
and this is the script:
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$ sed 's/.las//'
echo $no
done
Thank you in advance.
bash
What are you trying to accomplish with the braces? Also quote your variables.
â Jesse_b
Feb 25 at 14:04
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I got the following error:
./assemblyDB.116.las
test.sh: line 9: $ sed 's/.las//': bad substitution
and this is the script:
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$ sed 's/.las//'
echo $no
done
Thank you in advance.
bash
I got the following error:
./assemblyDB.116.las
test.sh: line 9: $ sed 's/.las//': bad substitution
and this is the script:
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$ sed 's/.las//'
echo $no
done
Thank you in advance.
bash
edited Feb 26 at 1:26
Charles Duffy
734413
734413
asked Feb 25 at 13:58
user977828
3401516
3401516
What are you trying to accomplish with the braces? Also quote your variables.
â Jesse_b
Feb 25 at 14:04
add a comment |Â
What are you trying to accomplish with the braces? Also quote your variables.
â Jesse_b
Feb 25 at 14:04
What are you trying to accomplish with the braces? Also quote your variables.
â Jesse_b
Feb 25 at 14:04
What are you trying to accomplish with the braces? Also quote your variables.
â Jesse_b
Feb 25 at 14:04
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
17
down vote
$ ...
(curly braces) marks several sorts of parameter expansion, the simplest of which is just expanding the value of a variable. The stuff inside braces isn't a valid parameter name, or any other expansion, so the shell complains.
You seem to want command substitution instead, for that, the syntax is $( ... )
(regular parenthesis).
Also, the ls
in ls $filename | sed...
seems a bit unnecessary, the variable expands to your filename, and ls
just passes it through. You could just use echo "$filename" | sed ...
instead.
That said, you could do those modifications directly in the shell:
no=$filename/assemblyDB. # remove first match
no=$no/.las
or, using the standard operators:
no=$filename#assemblyDB. # remove from start of string
no=$no%.las # remove from end of string
If you do run sed
, you may want to note that .
matches any character in regular expressions, so it would be more correct to quote it with a backslash. Also you can give one sed
instance both commands: sed -e 's/assemblyDB.//' -e 's/.las//'
.
And then for filename in $(find . -type f -name "assemblyDB.*.las"); do
has the issues of parsing ls, mostly the fact that whitespace and wildcards in the file names will break it. In ksh/Bash/zsh, you could do that whole loop in the shell:
shopt -s globstar # in Bash
for filename in **/assemblyDB.*.las; do
...
1
@Jesse_b, yes, but if your shell has<<<
, it probably has$var/pat/repl
too. If you do run sed, you could just give both rules to onesed
instance:sed -e 's/assemblyDB.//' -e 's/.las//'
â ilkkachu
Feb 25 at 14:22
Just wanted to point out UUOE ;)
â Jesse_b
Feb 25 at 14:28
add a comment |Â
up vote
0
down vote
Command substitution (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(ls $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
is equivalent, as already pointed out, to (line 3, no ls
)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(echo $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
or shorter (line 4 gone, now echo directly)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//' | sed 's/.las//'
done
and the sed command can be reduced to (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//;s/.las//'
done
or maybe extract the middle part with sed: (still line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed -r 's/.*assemblyDB.(.*).las/1/'"
done
now find-iterator instead of for-iterator: (line 1 to 3, 4 gone)
find . -type f -name "assemblyDB.*.las" -printf "%fn" -exec sh -c "
echo | sed -r 's/.*assemblyDB.(.*).las/1/'" ";"
assemblyDB.11.las
11
assemblyDB.9.las
9
assemblyDB.10.las
10
If your filenames are in such or a similar order, the following might work too:
for i in 8..12 ; do ls assemblyDB.$i.las && echo $i ; done 2>/dev/null
assemblyDB.9.las
9
assemblyDB.10.las
10
assemblyDB.11.las
11
(8 and 12 included, to demonstrate missing files in the sequence).
add a comment |Â
up vote
-3
down vote
Instead of $
use backticks `
[The button below Escape on your keyboard.]
2
Please don't use backticks. Use command substitution.$( ... )
â Jesse_b
Feb 25 at 14:04
Can you explain why back ticks are bad?
â Raja Nand Sharma
Feb 25 at 14:06
3
They are outdated, they are hard to read, they don't nest, and they can always be replaced by parenthesis command substitution. Additionally they are hard to place into inline code blocks on most markdown languages :)
â Jesse_b
Feb 25 at 14:07
Yeah, that is right. But in regards to this question where did my answer go wrong??
â Raja Nand Sharma
Feb 25 at 14:10
6
You suggested using backticks.
â Jesse_b
Feb 25 at 14:10
 |Â
show 4 more comments
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
17
down vote
$ ...
(curly braces) marks several sorts of parameter expansion, the simplest of which is just expanding the value of a variable. The stuff inside braces isn't a valid parameter name, or any other expansion, so the shell complains.
You seem to want command substitution instead, for that, the syntax is $( ... )
(regular parenthesis).
Also, the ls
in ls $filename | sed...
seems a bit unnecessary, the variable expands to your filename, and ls
just passes it through. You could just use echo "$filename" | sed ...
instead.
That said, you could do those modifications directly in the shell:
no=$filename/assemblyDB. # remove first match
no=$no/.las
or, using the standard operators:
no=$filename#assemblyDB. # remove from start of string
no=$no%.las # remove from end of string
If you do run sed
, you may want to note that .
matches any character in regular expressions, so it would be more correct to quote it with a backslash. Also you can give one sed
instance both commands: sed -e 's/assemblyDB.//' -e 's/.las//'
.
And then for filename in $(find . -type f -name "assemblyDB.*.las"); do
has the issues of parsing ls, mostly the fact that whitespace and wildcards in the file names will break it. In ksh/Bash/zsh, you could do that whole loop in the shell:
shopt -s globstar # in Bash
for filename in **/assemblyDB.*.las; do
...
1
@Jesse_b, yes, but if your shell has<<<
, it probably has$var/pat/repl
too. If you do run sed, you could just give both rules to onesed
instance:sed -e 's/assemblyDB.//' -e 's/.las//'
â ilkkachu
Feb 25 at 14:22
Just wanted to point out UUOE ;)
â Jesse_b
Feb 25 at 14:28
add a comment |Â
up vote
17
down vote
$ ...
(curly braces) marks several sorts of parameter expansion, the simplest of which is just expanding the value of a variable. The stuff inside braces isn't a valid parameter name, or any other expansion, so the shell complains.
You seem to want command substitution instead, for that, the syntax is $( ... )
(regular parenthesis).
Also, the ls
in ls $filename | sed...
seems a bit unnecessary, the variable expands to your filename, and ls
just passes it through. You could just use echo "$filename" | sed ...
instead.
That said, you could do those modifications directly in the shell:
no=$filename/assemblyDB. # remove first match
no=$no/.las
or, using the standard operators:
no=$filename#assemblyDB. # remove from start of string
no=$no%.las # remove from end of string
If you do run sed
, you may want to note that .
matches any character in regular expressions, so it would be more correct to quote it with a backslash. Also you can give one sed
instance both commands: sed -e 's/assemblyDB.//' -e 's/.las//'
.
And then for filename in $(find . -type f -name "assemblyDB.*.las"); do
has the issues of parsing ls, mostly the fact that whitespace and wildcards in the file names will break it. In ksh/Bash/zsh, you could do that whole loop in the shell:
shopt -s globstar # in Bash
for filename in **/assemblyDB.*.las; do
...
1
@Jesse_b, yes, but if your shell has<<<
, it probably has$var/pat/repl
too. If you do run sed, you could just give both rules to onesed
instance:sed -e 's/assemblyDB.//' -e 's/.las//'
â ilkkachu
Feb 25 at 14:22
Just wanted to point out UUOE ;)
â Jesse_b
Feb 25 at 14:28
add a comment |Â
up vote
17
down vote
up vote
17
down vote
$ ...
(curly braces) marks several sorts of parameter expansion, the simplest of which is just expanding the value of a variable. The stuff inside braces isn't a valid parameter name, or any other expansion, so the shell complains.
You seem to want command substitution instead, for that, the syntax is $( ... )
(regular parenthesis).
Also, the ls
in ls $filename | sed...
seems a bit unnecessary, the variable expands to your filename, and ls
just passes it through. You could just use echo "$filename" | sed ...
instead.
That said, you could do those modifications directly in the shell:
no=$filename/assemblyDB. # remove first match
no=$no/.las
or, using the standard operators:
no=$filename#assemblyDB. # remove from start of string
no=$no%.las # remove from end of string
If you do run sed
, you may want to note that .
matches any character in regular expressions, so it would be more correct to quote it with a backslash. Also you can give one sed
instance both commands: sed -e 's/assemblyDB.//' -e 's/.las//'
.
And then for filename in $(find . -type f -name "assemblyDB.*.las"); do
has the issues of parsing ls, mostly the fact that whitespace and wildcards in the file names will break it. In ksh/Bash/zsh, you could do that whole loop in the shell:
shopt -s globstar # in Bash
for filename in **/assemblyDB.*.las; do
...
$ ...
(curly braces) marks several sorts of parameter expansion, the simplest of which is just expanding the value of a variable. The stuff inside braces isn't a valid parameter name, or any other expansion, so the shell complains.
You seem to want command substitution instead, for that, the syntax is $( ... )
(regular parenthesis).
Also, the ls
in ls $filename | sed...
seems a bit unnecessary, the variable expands to your filename, and ls
just passes it through. You could just use echo "$filename" | sed ...
instead.
That said, you could do those modifications directly in the shell:
no=$filename/assemblyDB. # remove first match
no=$no/.las
or, using the standard operators:
no=$filename#assemblyDB. # remove from start of string
no=$no%.las # remove from end of string
If you do run sed
, you may want to note that .
matches any character in regular expressions, so it would be more correct to quote it with a backslash. Also you can give one sed
instance both commands: sed -e 's/assemblyDB.//' -e 's/.las//'
.
And then for filename in $(find . -type f -name "assemblyDB.*.las"); do
has the issues of parsing ls, mostly the fact that whitespace and wildcards in the file names will break it. In ksh/Bash/zsh, you could do that whole loop in the shell:
shopt -s globstar # in Bash
for filename in **/assemblyDB.*.las; do
...
edited Feb 25 at 14:25
answered Feb 25 at 14:08
ilkkachu
49.3k672136
49.3k672136
1
@Jesse_b, yes, but if your shell has<<<
, it probably has$var/pat/repl
too. If you do run sed, you could just give both rules to onesed
instance:sed -e 's/assemblyDB.//' -e 's/.las//'
â ilkkachu
Feb 25 at 14:22
Just wanted to point out UUOE ;)
â Jesse_b
Feb 25 at 14:28
add a comment |Â
1
@Jesse_b, yes, but if your shell has<<<
, it probably has$var/pat/repl
too. If you do run sed, you could just give both rules to onesed
instance:sed -e 's/assemblyDB.//' -e 's/.las//'
â ilkkachu
Feb 25 at 14:22
Just wanted to point out UUOE ;)
â Jesse_b
Feb 25 at 14:28
1
1
@Jesse_b, yes, but if your shell has
<<<
, it probably has $var/pat/repl
too. If you do run sed, you could just give both rules to one sed
instance: sed -e 's/assemblyDB.//' -e 's/.las//'
â ilkkachu
Feb 25 at 14:22
@Jesse_b, yes, but if your shell has
<<<
, it probably has $var/pat/repl
too. If you do run sed, you could just give both rules to one sed
instance: sed -e 's/assemblyDB.//' -e 's/.las//'
â ilkkachu
Feb 25 at 14:22
Just wanted to point out UUOE ;)
â Jesse_b
Feb 25 at 14:28
Just wanted to point out UUOE ;)
â Jesse_b
Feb 25 at 14:28
add a comment |Â
up vote
0
down vote
Command substitution (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(ls $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
is equivalent, as already pointed out, to (line 3, no ls
)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(echo $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
or shorter (line 4 gone, now echo directly)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//' | sed 's/.las//'
done
and the sed command can be reduced to (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//;s/.las//'
done
or maybe extract the middle part with sed: (still line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed -r 's/.*assemblyDB.(.*).las/1/'"
done
now find-iterator instead of for-iterator: (line 1 to 3, 4 gone)
find . -type f -name "assemblyDB.*.las" -printf "%fn" -exec sh -c "
echo | sed -r 's/.*assemblyDB.(.*).las/1/'" ";"
assemblyDB.11.las
11
assemblyDB.9.las
9
assemblyDB.10.las
10
If your filenames are in such or a similar order, the following might work too:
for i in 8..12 ; do ls assemblyDB.$i.las && echo $i ; done 2>/dev/null
assemblyDB.9.las
9
assemblyDB.10.las
10
assemblyDB.11.las
11
(8 and 12 included, to demonstrate missing files in the sequence).
add a comment |Â
up vote
0
down vote
Command substitution (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(ls $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
is equivalent, as already pointed out, to (line 3, no ls
)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(echo $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
or shorter (line 4 gone, now echo directly)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//' | sed 's/.las//'
done
and the sed command can be reduced to (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//;s/.las//'
done
or maybe extract the middle part with sed: (still line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed -r 's/.*assemblyDB.(.*).las/1/'"
done
now find-iterator instead of for-iterator: (line 1 to 3, 4 gone)
find . -type f -name "assemblyDB.*.las" -printf "%fn" -exec sh -c "
echo | sed -r 's/.*assemblyDB.(.*).las/1/'" ";"
assemblyDB.11.las
11
assemblyDB.9.las
9
assemblyDB.10.las
10
If your filenames are in such or a similar order, the following might work too:
for i in 8..12 ; do ls assemblyDB.$i.las && echo $i ; done 2>/dev/null
assemblyDB.9.las
9
assemblyDB.10.las
10
assemblyDB.11.las
11
(8 and 12 included, to demonstrate missing files in the sequence).
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Command substitution (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(ls $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
is equivalent, as already pointed out, to (line 3, no ls
)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(echo $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
or shorter (line 4 gone, now echo directly)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//' | sed 's/.las//'
done
and the sed command can be reduced to (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//;s/.las//'
done
or maybe extract the middle part with sed: (still line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed -r 's/.*assemblyDB.(.*).las/1/'"
done
now find-iterator instead of for-iterator: (line 1 to 3, 4 gone)
find . -type f -name "assemblyDB.*.las" -printf "%fn" -exec sh -c "
echo | sed -r 's/.*assemblyDB.(.*).las/1/'" ";"
assemblyDB.11.las
11
assemblyDB.9.las
9
assemblyDB.10.las
10
If your filenames are in such or a similar order, the following might work too:
for i in 8..12 ; do ls assemblyDB.$i.las && echo $i ; done 2>/dev/null
assemblyDB.9.las
9
assemblyDB.10.las
10
assemblyDB.11.las
11
(8 and 12 included, to demonstrate missing files in the sequence).
Command substitution (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(ls $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
is equivalent, as already pointed out, to (line 3, no ls
)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
no=$(echo $filename | sed 's/assemblyDB.//' | sed 's/.las//')
echo $no
done
or shorter (line 4 gone, now echo directly)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//' | sed 's/.las//'
done
and the sed command can be reduced to (line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed 's/assemblyDB.//;s/.las//'
done
or maybe extract the middle part with sed: (still line 3)
for filename in $(find . -type f -name "assemblyDB.*.las"); do
echo $filename
echo $filename | sed -r 's/.*assemblyDB.(.*).las/1/'"
done
now find-iterator instead of for-iterator: (line 1 to 3, 4 gone)
find . -type f -name "assemblyDB.*.las" -printf "%fn" -exec sh -c "
echo | sed -r 's/.*assemblyDB.(.*).las/1/'" ";"
assemblyDB.11.las
11
assemblyDB.9.las
9
assemblyDB.10.las
10
If your filenames are in such or a similar order, the following might work too:
for i in 8..12 ; do ls assemblyDB.$i.las && echo $i ; done 2>/dev/null
assemblyDB.9.las
9
assemblyDB.10.las
10
assemblyDB.11.las
11
(8 and 12 included, to demonstrate missing files in the sequence).
answered Feb 26 at 2:46
user unknown
6,95412148
6,95412148
add a comment |Â
add a comment |Â
up vote
-3
down vote
Instead of $
use backticks `
[The button below Escape on your keyboard.]
2
Please don't use backticks. Use command substitution.$( ... )
â Jesse_b
Feb 25 at 14:04
Can you explain why back ticks are bad?
â Raja Nand Sharma
Feb 25 at 14:06
3
They are outdated, they are hard to read, they don't nest, and they can always be replaced by parenthesis command substitution. Additionally they are hard to place into inline code blocks on most markdown languages :)
â Jesse_b
Feb 25 at 14:07
Yeah, that is right. But in regards to this question where did my answer go wrong??
â Raja Nand Sharma
Feb 25 at 14:10
6
You suggested using backticks.
â Jesse_b
Feb 25 at 14:10
 |Â
show 4 more comments
up vote
-3
down vote
Instead of $
use backticks `
[The button below Escape on your keyboard.]
2
Please don't use backticks. Use command substitution.$( ... )
â Jesse_b
Feb 25 at 14:04
Can you explain why back ticks are bad?
â Raja Nand Sharma
Feb 25 at 14:06
3
They are outdated, they are hard to read, they don't nest, and they can always be replaced by parenthesis command substitution. Additionally they are hard to place into inline code blocks on most markdown languages :)
â Jesse_b
Feb 25 at 14:07
Yeah, that is right. But in regards to this question where did my answer go wrong??
â Raja Nand Sharma
Feb 25 at 14:10
6
You suggested using backticks.
â Jesse_b
Feb 25 at 14:10
 |Â
show 4 more comments
up vote
-3
down vote
up vote
-3
down vote
Instead of $
use backticks `
[The button below Escape on your keyboard.]
Instead of $
use backticks `
[The button below Escape on your keyboard.]
edited Feb 25 at 14:11
Jesse_b
10.4k22658
10.4k22658
answered Feb 25 at 14:04
Raja Nand Sharma
11
11
2
Please don't use backticks. Use command substitution.$( ... )
â Jesse_b
Feb 25 at 14:04
Can you explain why back ticks are bad?
â Raja Nand Sharma
Feb 25 at 14:06
3
They are outdated, they are hard to read, they don't nest, and they can always be replaced by parenthesis command substitution. Additionally they are hard to place into inline code blocks on most markdown languages :)
â Jesse_b
Feb 25 at 14:07
Yeah, that is right. But in regards to this question where did my answer go wrong??
â Raja Nand Sharma
Feb 25 at 14:10
6
You suggested using backticks.
â Jesse_b
Feb 25 at 14:10
 |Â
show 4 more comments
2
Please don't use backticks. Use command substitution.$( ... )
â Jesse_b
Feb 25 at 14:04
Can you explain why back ticks are bad?
â Raja Nand Sharma
Feb 25 at 14:06
3
They are outdated, they are hard to read, they don't nest, and they can always be replaced by parenthesis command substitution. Additionally they are hard to place into inline code blocks on most markdown languages :)
â Jesse_b
Feb 25 at 14:07
Yeah, that is right. But in regards to this question where did my answer go wrong??
â Raja Nand Sharma
Feb 25 at 14:10
6
You suggested using backticks.
â Jesse_b
Feb 25 at 14:10
2
2
Please don't use backticks. Use command substitution.
$( ... )
â Jesse_b
Feb 25 at 14:04
Please don't use backticks. Use command substitution.
$( ... )
â Jesse_b
Feb 25 at 14:04
Can you explain why back ticks are bad?
â Raja Nand Sharma
Feb 25 at 14:06
Can you explain why back ticks are bad?
â Raja Nand Sharma
Feb 25 at 14:06
3
3
They are outdated, they are hard to read, they don't nest, and they can always be replaced by parenthesis command substitution. Additionally they are hard to place into inline code blocks on most markdown languages :)
â Jesse_b
Feb 25 at 14:07
They are outdated, they are hard to read, they don't nest, and they can always be replaced by parenthesis command substitution. Additionally they are hard to place into inline code blocks on most markdown languages :)
â Jesse_b
Feb 25 at 14:07
Yeah, that is right. But in regards to this question where did my answer go wrong??
â Raja Nand Sharma
Feb 25 at 14:10
Yeah, that is right. But in regards to this question where did my answer go wrong??
â Raja Nand Sharma
Feb 25 at 14:10
6
6
You suggested using backticks.
â Jesse_b
Feb 25 at 14:10
You suggested using backticks.
â Jesse_b
Feb 25 at 14:10
 |Â
show 4 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426458%2fbad-substitution-running-ls-sed-with-bash%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What are you trying to accomplish with the braces? Also quote your variables.
â Jesse_b
Feb 25 at 14:04