I'm actually using a Macbook Pro, and am quite new to non-Windows OS' (I know, for shame!), and I've made the mistake of overwriting my bash profile, instead of appending to it... (n00b!).What I do have is a couple of open tabs in the Terminal, and am hoping that there might be a way of recovering my .bash_profile from this (or any way really).
Can I recover my .bash_profile from an open Terminal tab?
bash;command line;terminal;bashrc
If your terminal is still open, type env: it will display all your environment variables. If it's a fresh install or if you never made any change, the most important variables are PATH (this one always exist) and LD_LIBRARY_PATH (may not exists, I'm not used to osx).For instance:$ env...PATH=/usr/bin:/bin:/home/user/bin:/sbin...It's also a common thing to source .bashrc in that file.Then you can edit your .bash_profile to add a line like this:# Source your .bashrcif [ -f ~/.bashrc ]; then  source ~/.bashrcfi# Export the interesting env variables you#   displayed from env command previouslyexport PATH=/usr/bin:/bin:/home/user/bin:/sbinIt's not a real solution since it's not a real backup, but keep in mind that as long your terminal is open, you can know your environment variables, and main purpose of .bash_profile is to set those variables.Also, you may have some aliases: in your opened terminal, type alias to display all the defined aliases. You can copy and paste the ouput as-is in your .bash_profile. (obviously, if those aliases are available in your .bashrc you don't need to define them in your .bash_profile since you source the .bashrc previously.)