Dear Roman, thank you for both suggestions. By the way, can I ask why it is necessary to re-introduce the array context by another pair of parentheses, if the expression already produces an array value? Or does the ${...:|...} expression produce a string which needs to be parsed again? Would this cause problems if any of the path elements contained a space in the file name? Thank you, Peter пон, 2. нов 2020. у 12:25 Roman Perepelitsa је написао/ла: > On Mon, Nov 2, 2020 at 12:11 PM Peter Slížik > wrote: > > > > I would like to remove an element from an array - actually a path from > the $path variable. After some googling, I've discovered the ${array:|excl} > syntax. > > > > Here is my code: > > > > excl=($path_to_remove) > > export path=${path:|excl} > > This is pretty close. Here's the correct syntax: > > excl=($path_to_remove) > path=(${path:|excl}) > > However, if you want to remove just one element, there is a simpler way: > > path=(${path:#$path_to_remove}) > > Roman. >