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

In Bash (not every shell supports this) functions can be exported, which enables this nice pattern with xargs:

    myfunc() {
        printf " %s" "I got these arguments:" "$@" $'\n'
    }
    export -f myfunc
    seq 6 | xargs -n2 bash -c 'myfunc "$@"' "$0"



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

Search: