I have a variable in bash which is space separated values and I would like it to appear in alphabetic order.
I can do it on separate lines thus:
which gives:
Beaky
Dave
Dee
Dozy
Mick
Tich
but what I want is
Beaky Dave Dee Dozy Mick Tich
I can do it on separate lines thus:
Code:
str='Tich Dave Mick Dozy Beaky Dee' for i in `echo $str`; do echo $i done | sort
Beaky
Dave
Dee
Dozy
Mick
Tich
but what I want is
Beaky Dave Dee Dozy Mick Tich
Comment