Skip to main content
added 88 characters in body
Source Link
steeldriver
  • 83.8k
  • 12
  • 124
  • 175

Well, zsh has a :| parameter expansion operator for array subtraction - so a klunky way to do it would be to define a second array consisting of only an empty element

b=('')

and then do

 % echo ${(j./.)a:|b}

a/b/c

However it feels like there ought to be a way to do it without the additional array

... and indeed there is.

Well, zsh has a :| parameter expansion operator for array subtraction - so a klunky way to do it would be to define a second array consisting of only an empty element

b=('')

and then do

 % echo ${(j./.)a:|b}

a/b/c

However it feels like there ought to be a way to do it without the additional array.

Well, zsh has a :| parameter expansion operator for array subtraction - so a klunky way to do it would be to define a second array consisting of only an empty element

b=('')

and then do

 % echo ${(j./.)a:|b}

a/b/c

However it feels like there ought to be a way to do it without the additional array

... and indeed there is.

Source Link
steeldriver
  • 83.8k
  • 12
  • 124
  • 175

Well, zsh has a :| parameter expansion operator for array subtraction - so a klunky way to do it would be to define a second array consisting of only an empty element

b=('')

and then do

 % echo ${(j./.)a:|b}

a/b/c

However it feels like there ought to be a way to do it without the additional array.