sed is not seductive.
マルイ 89式 小銃 折曲式銃床 本体+バッテリー+充電器 マスターフルセット
- 出版社/メーカー: 東京マルイ
- メディア: おもちゃ&ホビー
- クリック: 17回
- この商品を含むブログを見る
Failed attempt: array_unique compliant on shellscript
I've just started writing shellscript. I am noob and unfortunately, stupid enough not to be able to write array_unique compliant by myself. I wanted to know the way to elegantly implement array_unique compliant on shellscript, but Google didn't help me out.
FYI, I pasted the code supposed to work correctly as far as I expect.
#!/bin/bash # Array containing non-unique elements ArrayNotUnique=(AK47 SR-16 MP5 M4 MP5 AA-12 AK47 Type89 AK47) # It doesn't work! f*! $UniqueArray=($(echo ${ArrayNotUnique[@]} | sed s/\s/\n/g | sort | uniq | sed s/\n/\s/g))
I don't understand.