I need two make a new bash array, not including elements which are in second one. And then use this array in while loop:
while [ -n "${ids_toproc[0]}" ] ; do
Here is a code a implemented:
all_ids=( /input/sub-* )
all_ids=( "${all_ids[@]#/input/sub-}" )
all_ids=( "${all_ids[@]%/}" )
exist_ids=( /output/fmriprep/sub-*.html )
exist_ids=( "${exist_ids[@]#/output/fmriprep/sub-}" )
exist_ids=( "${exist_ids[@]%/}" )
exist_ids=( "${exist_ids[@]%%.*}" ) # delete extention
ids_toproc=( `echo ${all_ids[@]} ${exist_ids[@]} | tr ' ' '\n' | sort | uniq -u` )
Is code is ok? is it right way to do compare?