Sometimes (or may be all the time) an Alias and Function for a command works the same way. For example, following Alias and Function of Ping Command:
alias Pingoogle='ping -c 3 google.com && echo "internet working..."'
Pingoogle() {ping -c 3 google.com && echo "internet working...";}
works the same way by producing same output. But, My question is that in this situation which is more proper (or professional)? Setting Alias for such commands or Using Functions?
&&
or nested quotes) into your aliases it gets hard to reason about. Functions are much cleaner and you don't have to wrestle with escaping everything properly. – dimo414 May 08 '20 at 04:06