-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.

g_rmz
  • 305
  • 1
  • 3
  • 9

2 Answers2

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.

SaxDaddy
  • 3,927
  • 21
  • 19
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.

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