Thanks, I had no idea. I guess I've never used aliases in scripts, but I would've assumed that they'd just work the same as in interactive mode. Good to know.
BTW aliases come from csh, and there they support arguments, which makes them similar to functions.
$ alias foo='seq 3 | '
$ foo cat
1
2
3
Functions are functionsCan't do that without eval, which is another can of worms. Aliases are fine
Working example:
pzoppin() {
printf 'echo is for torrent scene n00bs from %s\n' "$*"
trap "printf '%s\n' <<< \"$*\"" RETURN EXIT SIGINT SIGTERM
}
export -f pzoppin
echo -e 'irc\0mamas donuts\0starseeds' \
| xargs -0 -n 1 -I {} /usr/bin/env bash -c '
echo hi
pzoppin "$*"
echo byee
' _ {}
The above will fail miserably without the magic incantation: `export -f pzoppin'
Why'd they design an otherwise perfectly usable, mapless language without default c-style global functions? :)