-1

I'm currently using the Homebrew package manager, and I have to say that it is really really great!

My question is: there is a way to automate brew update and brew upgrade in order to execute this commands when a shell is opened? I'm not very expert about bash programming, so I'm not sure if this thing is possible or not, I'm currently using iTerm.

1

2 Answers 2

4

I agree with @fd0 that this probably shouldn't be automated to the point of launching it for every shell. This can get ugly if you have multiple shell windows. I opted for a semi-automated solution by creating an alias in my ~/.profile that performs several brew functions. Check out this post for details.

1
  • Glad I could help.
    – SaxDaddy
    Commented Sep 21, 2015 at 8:23
1

Automating such a process in a shell startup file is a bad idea. Every new instance of a shell would execute both commands. You could place a function in your .bashrc and and call the function which would cut down on the number of characters that you need to type but that's not a real game changer.

2
  • Is possibile to write the function in order to execute it only the first time the shell is opened?
    – g_rmz
    Commented Sep 19, 2015 at 16:53
  • 1
    If you want to automate the process then use launchd or cron. Don't use a shell startup file.
    – fd0
    Commented Sep 19, 2015 at 17:27

Not the answer you're looking for? Browse other questions tagged .