5 ms·
You mean "$_". !$ refers to the previous command in the history.
by obtu 14y ago
You mean "$_". !$ refers to the previous command in the history.
- deleted 14y ago[deleted]
- earnubs 14y agoFairly sure I meant !$ :) http://www.gnu.org/software/bash/manual/bashref.html#Word-Designators http://www.gnu.org/software/bash/manual/bashref.html#Word-De...
- obtu 14y agoSeriously, try it. History expansion works on input lines separated by the user asking the shell to run them, it can't cross reference command arguments on the same command line.
- earnubs 14y agoYou are correct, so have an upvote. && in OS X seems to put the left side into history and works as I described, but it didn't work when I tried it in Ubuntu 10. $_ works in both.
- earnubs 14y agoI have tried both, the difference is only that !$ echos the expanded command, while $_ simply runs the expanded command; both create a directory and cd into it. (I'm running OS X, FWIW)
- seclorum 14y ago!! refers to the previous command in the history. !$ refers to the last cmd-line option in the history.
- obtu 14y agoI know that, the bit I want to emphasize is that it won't be the mkdir argument that is on the same line.