Homebrew in bash profile
The brew command is in /usr/local/bin, so you need to ensure that you either use the full path to brew in your commands, i.e. /usr/local/bin/brew or you need to set your PATH environment variable in your profile before using brew, e.g.:

export PATH=/usr/local/bin:$PATH