Hacker News new | past | comments | ask | show | jobs | submit login

A pure bash alternative for comparison.

    merge-args() {
        local res
        for i; do
            case ":${res}:" in
                *:"$i":*)
                    ;;
                *)
                    res=${res+$res:}$i
            esac
        done
        echo $res
    }



That is pretty neat, I did not know that 'for i' on it's own could iterate the args like that.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: