Hacker News new | past | comments | ask | show | jobs | submit login

Bash functions are very useful when you want to manipulate the state of the shell in some way. That is, you write a function for it and stick that function in your .bash_profile. (Unless ofc an alias would be able to perform the job in which case one should just make an alias instead.)

Beyond that, I have been in many situations where standalone shell scripts make the most sense for a task and in which case bash functions have helped me organize the code such that it is both more readable and also so that I don't have to repeat sections of code multiple times within a single script.

It all comes down to personal experience and preference, I think.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: