Compare element between two similar array
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Suppose such a minimal task to select elements in B but not in A
file_list1=(a.sh b.sh c.sh)
file_list2=(b.sh c.sh d.sh)
for i in files_list1; do
for k in files_list2; do
if [[ $k in $(echo $i) ]]; then
echo
else
echo $k
fi
done
done
it report errors:
$ bash compare.sh
compare.sh: line 5: conditional binary operator expected
compare.sh: line 5: syntax error near `in'
compare.sh: line 5: ` if [[ $k in $(echo $i) ]]; then'
if not apply in
, how could get the code working?
shell-script
New contributor
add a comment |Â
up vote
0
down vote
favorite
Suppose such a minimal task to select elements in B but not in A
file_list1=(a.sh b.sh c.sh)
file_list2=(b.sh c.sh d.sh)
for i in files_list1; do
for k in files_list2; do
if [[ $k in $(echo $i) ]]; then
echo
else
echo $k
fi
done
done
it report errors:
$ bash compare.sh
compare.sh: line 5: conditional binary operator expected
compare.sh: line 5: syntax error near `in'
compare.sh: line 5: ` if [[ $k in $(echo $i) ]]; then'
if not apply in
, how could get the code working?
shell-script
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Suppose such a minimal task to select elements in B but not in A
file_list1=(a.sh b.sh c.sh)
file_list2=(b.sh c.sh d.sh)
for i in files_list1; do
for k in files_list2; do
if [[ $k in $(echo $i) ]]; then
echo
else
echo $k
fi
done
done
it report errors:
$ bash compare.sh
compare.sh: line 5: conditional binary operator expected
compare.sh: line 5: syntax error near `in'
compare.sh: line 5: ` if [[ $k in $(echo $i) ]]; then'
if not apply in
, how could get the code working?
shell-script
New contributor
Suppose such a minimal task to select elements in B but not in A
file_list1=(a.sh b.sh c.sh)
file_list2=(b.sh c.sh d.sh)
for i in files_list1; do
for k in files_list2; do
if [[ $k in $(echo $i) ]]; then
echo
else
echo $k
fi
done
done
it report errors:
$ bash compare.sh
compare.sh: line 5: conditional binary operator expected
compare.sh: line 5: syntax error near `in'
compare.sh: line 5: ` if [[ $k in $(echo $i) ]]; then'
if not apply in
, how could get the code working?
shell-script
shell-script
New contributor
New contributor
New contributor
asked 2 mins ago
Sawajiri
1906
1906
New contributor
New contributor
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Â
draft saved
draft discarded
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Â
draft saved
draft discarded
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%2f479315%2fcompare-element-between-two-similar-array%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