Here is my script:
echo "Defining aliases" echo $$ echo " s=screen v=vlock -a j=jobs " | sed '/^$/d' | while read alias do echo $$ alias "$alias" alias | wc -l done
And here is its output:
parthian@computer$ . aliases Defining aliases 3744 3744 4 3744 5 3744 6 parthian@computer$ ps -p $$ PID TTY TIME CMD 3744 pts/1 00:00:03 bash parthian@computer$ alias | wc -l 3
I'm flummoxed. This is some of the most straightforward code I've ever written, and it's not doing what it's supposed to do.
EDIT: When I change the echo lines from
echo $$ to
echo $$ $BASHPID, the second PID (
$BASHPID) is different inside the loop, but
$$ remains the same throughout. Could this be the issue?