News for hackers. Stuff that matters.
Re:Why “alias” is my last resort for aliases by dcb_lu on Thursday March 06, 2025 @03:35AM (#43277853)
I do something similar to my .bash_aliases, but with a few short additions to make sure running it multiple times doesn't have any strange side effects. For instance:

  function edit_load() {
    $EDITOR $1
    source $1
    if [ $? -eq 0 ]
    then
      echo "$1 updated."
    fi
  }
  alias aliases="edit_load ~/.bash_aliases"

  # to make sure I don't add things to $PATH on each reload
  append_path () {
    case ":$PATH:" in
      *:"$1":*)
        ;;
      \*)
        PATH="${PATH:+$PATH:}$1"
    esac
  }
  append_path '/blah/blah/bin'

There are no comments on this comment yet.