Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Solved] a variable list filtering via sed + "blacklist-variable" && Print,sed & userdbctl an other Solution. (all under CCSA/GPL2/3, Take your pick, able to add ITBS) #76

Answered by PsypherPunk
blackcrack asked this question in Q&A
Discussion options

You must be logged in to vote

Presuming your variables are as above:

dirlist="blackcrack akira lost&found workshop garage office"
blacklist="lost&found garage workshop"

If you turn them into arrays then yes, you can exclude one from the other:

dirlist_array=(${dirlist})
blacklist_array=(${blacklist})

for x in ${blacklist_array[@]}
do
    dirlist_array=("${dirlist_array[@]/$x}")
done

That will give you:

$ echo ${dirlist_array[@]}
blackcrack akira office

Is that of any use?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@blackcrack
Comment options

Answer selected by blackcrack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
2 participants
Converted from issue

This discussion was converted from issue #59 on October 04, 2022 10:50.