This is a bit pie-in-the-sky but I've learned not to make assumptions about the capabilities of anything, since I'm frequently amazed by hidden features buried in UNIX/Linux tools, so here goes.
I often find myself running commands where I need to locate a file on a system and then once I've eyeballed the location for sanity, I need to do something with the path.
Take this workflow, for instance:
$ which foo.sh /path/to/something/foo.sh $ vim `which foo.sh`
That second command takes me 1-2 entire seconds to type. It's madness. I do it so often it's starting to feel like boilerplate that I should be able to factor out.
What I'd love is fantasy shell magic that would let me do the following:
$ which foo.sh /path/to/something/foo.sh $ which foo.sh |! vim
This second case is far superior IMO. I find it much easier to type "|! vim" after the up-arrow than I do seeking the start of the line, typing vim backtick, then seeking the end of the line and typing a final backtick.
Imagine the pipe-bang operator doing something similar to "| xargs,vim" but in a way that preserves the terminal for vim and as also something much shorter to type. Pipe-bang is of course a syntax error in bash and it cannot be aliased, so the thing I want to do seems impossible.
Or is it? I suspect this is a case of TMTOWTDI but I'm having a mental block.
It doesn't have to be literally pipe-bang either, but something close is the goal.