bash: Complex history command changes (history expansion).



  • Take into account the main readme for this section. README first.

    Note: Best not used on root type system work. More suited to development type work.

    Also see: https://www.gnu.org/software/bash/manual/bash.html#History-Interaction

    Changing a command using what is type so far. The !#:^.txt takes word 1, which is /home/training/abc and renames it with suffix .txt.

    $ mv /home/training/abc !#:^.txt
    mv /home/training/abc /home/training/abc.txt
    

    Using a modifier to change the suffix.

    $ mv /home/training/abc.txt !#:^:s/txt/pdf/
    mv /home/training/abc.txt /home/training/abc.pdf
    

Log in to reply
 

© Lightnetics 2024