Hacker News new | ask | show | jobs
by vermaden 1022 days ago
Just another alias ...

    # WAS
    alias ls='exa ...'

    # IS
    alias exa='eza ...'
    alias ls='exa ...'
1 comments

Just another "command not found" on that remote machine you forgot you were on.
Not hard to fix:

  if command -v exa &> /dev/null; then
      alias ls='exa'
  fi
I do it differently. It supports not having to reload aliases after installing.

    alias vim='$(command -v nvim || echo vim)'
Checking everytime you use the alias, instead on when you init the shell. How often do you need to install a packages?
This is the problem with all tools outside the most basic and you have to keep muscle memory for grep and ls to deal with it. Thus the fancy replacement tools have a cost.

I can bear to pay that cost for "fd" (fdfind) and ripgrep but exa didn't really offer me enough.

I used to subscribe to this idea too, but I've since tried to leave it behind. I ended up just not using tools that gave me a benefit the majority of the time. Ripgrep is a great example. So much better than grep IMO but not going to be on that remote machine. When I need to, I'll adapt to egrep. Same with vim plugins. I ended up just not using stuff I liked so I wouldn't get used to it. Felt backwards to me.

If you spend a ton of time on remote machines you won't get control of, I can absolutely get it though. I think as long as you know the backup and you can adapt, we'll be fine most of the time. Knowing the idioms to get you part of the way there to the convenient functionality is a good enough mental polyfill.

There was a time when I was working on AIX, Solaris and HPUx as well as Linux. In that situation it paid to install gnu tools everywhere (especially bash, make and sed!!) or build versions of them in my home dir so I could have them on any machine.

In THAT situation the constant pain of differences in behaviour was reduced by selecting a common nonstandard tool. It is really the same argument that you're making: that being able to work roughly the same everywhere has great value.