I'd like to know the shortest command for correcting a mistake in the previously executed command.
Given I executed the following command
cd /Users/USERNAME/Library/Preferences/ByHost
I would like to be able to execute a new command that takes the previous command, pipes it through grep
or a similar Unix tool, and then executes. Something like this in (my admittedly uneducated) psuedo-command.
!! | xargs 's/$1/USERNAME/cirrostratus/g'
This command would execute
cd /Users/cirrostratus/Library/Preferences/ByHost
Alternately, piping a string, searching and replacing on it and executing in one line would be my second choice.