Topic: https://brettterpstra.com/2014/08/15/shell-tricks-a-time-to-kill/
hide preview

What's next? verify your email address for reply notifications!

Daniel Whicker 10y, 212d ago

pgrep and pkill arent's distributed natively with OSX. You can add them by installing proctors via fink (or maybe brew?). fp as written will work for OSX, but needs some subtle adjust for Solaris or Linux.

remark link
hide preview

What's next? verify your email address for reply notifications!

GT 10y, 206d ago

Perhaps this package isn't installed by default, but it certainly comes from Apple:

 % pkgutil --files com.apple.pkg.BSD | grep pgrep
usr/bin/pgrep
usr/bin/zipgrep
usr/share/man/man1/pgrep.1
usr/share/man/man1/zipgrep.1
usr/share/zsh/5.0.2/functions/_pgrep
remark link parent
hide preview

What's next? verify your email address for reply notifications!

Daniel Whicker 10y, 206d ago

You're absolutely correct! When did they add this one? proctools has been on my build list since 10.4.

hide preview

What's next? verify your email address for reply notifications!

GT 10y, 213d ago

You could probably use pgrep, e.g.

/usr/bin/pgrep -fi pattern

as a simpler implementation of your fp() function, although I might be missing a subtlety of your command pipeline.

hide preview

What's next? verify your email address for reply notifications!