Historic Bourne shell behaviour

Sep 14, 2012 22:47


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.

programming

Previous post Next post
Up