How to make this bash command not allow the empty string in a âstring substitutionâ [this,that]*?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Consider the command:
scp my-machine:/home/user/a-folder/[massif,callgrind]* .
Where my intent is to copy only the files from my-machine:/home/user/a-folder/
that start with massif
or callgrind
keywords. As of right now, the substitution of [massif,callgrind]
is also considering the empty string, thus copying any file in the folder because of the *
.
What do I have to change to make it work correctly?
bash shell-script
New contributor
add a comment |Â
up vote
0
down vote
favorite
Consider the command:
scp my-machine:/home/user/a-folder/[massif,callgrind]* .
Where my intent is to copy only the files from my-machine:/home/user/a-folder/
that start with massif
or callgrind
keywords. As of right now, the substitution of [massif,callgrind]
is also considering the empty string, thus copying any file in the folder because of the *
.
What do I have to change to make it work correctly?
bash shell-script
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Consider the command:
scp my-machine:/home/user/a-folder/[massif,callgrind]* .
Where my intent is to copy only the files from my-machine:/home/user/a-folder/
that start with massif
or callgrind
keywords. As of right now, the substitution of [massif,callgrind]
is also considering the empty string, thus copying any file in the folder because of the *
.
What do I have to change to make it work correctly?
bash shell-script
New contributor
Consider the command:
scp my-machine:/home/user/a-folder/[massif,callgrind]* .
Where my intent is to copy only the files from my-machine:/home/user/a-folder/
that start with massif
or callgrind
keywords. As of right now, the substitution of [massif,callgrind]
is also considering the empty string, thus copying any file in the folder because of the *
.
What do I have to change to make it work correctly?
bash shell-script
bash shell-script
New contributor
New contributor
New contributor
asked 5 mins ago
nico
11
11
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
It sounds like you want curly-brackets there:
scp my-machine:/home/user/a-folder/massif,callgrind* .
Otherwise you're matching on single characters, rather than the two complete strings.
New contributor
Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
â nico
1 min ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It sounds like you want curly-brackets there:
scp my-machine:/home/user/a-folder/massif,callgrind* .
Otherwise you're matching on single characters, rather than the two complete strings.
New contributor
Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
â nico
1 min ago
add a comment |Â
up vote
0
down vote
It sounds like you want curly-brackets there:
scp my-machine:/home/user/a-folder/massif,callgrind* .
Otherwise you're matching on single characters, rather than the two complete strings.
New contributor
Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
â nico
1 min ago
add a comment |Â
up vote
0
down vote
up vote
0
down vote
It sounds like you want curly-brackets there:
scp my-machine:/home/user/a-folder/massif,callgrind* .
Otherwise you're matching on single characters, rather than the two complete strings.
New contributor
It sounds like you want curly-brackets there:
scp my-machine:/home/user/a-folder/massif,callgrind* .
Otherwise you're matching on single characters, rather than the two complete strings.
New contributor
New contributor
answered 3 mins ago
Jeremy Kerr
1054
1054
New contributor
New contributor
Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
â nico
1 min ago
add a comment |Â
Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
â nico
1 min ago
Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
â nico
1 min ago
Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
â nico
1 min ago
add a comment |Â
nico is a new contributor. Be nice, and check out our Code of Conduct.
nico is a new contributor. Be nice, and check out our Code of Conduct.
nico is a new contributor. Be nice, and check out our Code of Conduct.
nico is a new contributor. Be nice, and check out our Code of Conduct.
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%2f477664%2fhow-to-make-this-bash-command-not-allow-the-empty-string-in-a-string-substituti%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