Log in

Sep. 14th, 2012 @ 10:47 pm Historic Bourne shell behaviour

Spot the problem in the following shell code when run under /bin/sh.

grep ^beginning file

Some versions of sh use ^ (caret) as a synonym for | (pipe). So grep doesn’t have a pattern and the shell likely can’t find beginning in the path.

Luckily, bash doesn’t implement this behaviour, so I avoided learning about this until today.

About this entry