Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • If this was already asked, please point me toward the question it is duplicating. It is very hard to search for character sequences like !#. Commented Apr 27, 2016 at 13:09
  • Did you try it? It just repeats everything you have typed on the current command line. e.g echo !# executes ` echo echo` Commented Apr 27, 2016 at 13:20
  • 2
    For example, if you start a command with 'ls' then follow with ' !#', the command would read 'ls ls'. Something more useful would be modifying a copy of the current line's last argument, a long filename maybe. 'cp longname !#:$' would expand to 'cp longname longname'. Use your bind key sequence (esc-ctrl-e by default I think?) for history expansion to "expand" the !#. Commented Apr 27, 2016 at 13:21
  • In the related posts is an excellent example: unix.stackexchange.com/questions/236382/… Commented Apr 27, 2016 at 13:23