• palordrolap@fedia.io
    link
    fedilink
    arrow-up
    0
    ·
    9 days ago

    I have an alias called save_aliases that does alias > ~/.bash_aliases. alias on its own just dumps all the existing aliases to the terminal in a format that can be parsed by Bash.

    I felt especially clever when I came up with that and used it to save itself.

    Bonus fact: ${BASH_ALIASES["name-here"]} is a way to get at the contents of an alias without resorting sed or cut shenanigans on the output of the alias command.

    • Pankkake@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      8 days ago

      Bonus fact: ${BASH_ALIASES["name-here"]} is a way to get at the contents of an alias without resorting sed or cut shenanigans on the output of the alias command.

      Doesn’t alias name-here already do that? That or I didn’t get what you mean.