Comment

Comment by hnlmorg

You can also do:

    grep “thing I want” !$
Bash (and similar) will replace !$ with the last parameter of the previous command.

This is a trick I’ve used lots when wanting to perform a non-piping operation on a command I’ve ‘cat’ed (eg ‘rm -v !$’)

I’d never criticise anyone for “useless” use of ‘cat’ though. If the fork() overhead was really that critical then it wouldn’t be a shell command to begin with.

parent hnlmorg 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton