vim-pad
vim-pad copied to clipboard
grep -P is not always available.
trafficstars
The default search_ backend is effecively grep -P which is not available in all grep implementations. For instance many BSD's including OS X.
Any ideas how to detect this without having to run and parse grep --version?
I'd say check the exit status. If the exit status is >1 then there was an error.
% uname -s
Linux
% echo 'testing P' | grep -P test > /dev/null 2>&1
% echo $?
0
% uname -s
Darwin
% echo 'testing P' | grep -P test > /dev/null 2>&1
% echo $?
2