I’d like to define it once and use it anywhere.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
While I basically agree with @eduffy, I typically put such functions in a file either in the user’s home directory or if the scripts are shared between users in a directory in the user’s path. I would then source the file
(. ~/FILE or . $(type -p FILE))in the .bash_profile. This allows you to ‘re-source’ the file if necessary (i.e., you change something in it) w/o having to re-login, etc.