I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
I have a few comments:
It's not going to load .bash_profile on a lot of systems, depending on where you are and what you're doing (.bashrc might be used instead).
You don't need to create a file before you edit it (if you leave this step out it's less for people to learn).
It looks like your "Windows version setup" is git configuration - did you paste this in from an article from your blog or something? On Windows it would be using WSL or Cygwin or git bash. I have no experience of the latter, so I don't know what I'm talking about!
If you run clear right at the start, then it makes the screen neat, but it means you miss any warnings or errors that might have appeared as the shell started up.
Why do you want it to beep (tput bel) every time your open a new shell?
What's $dir? in the npm section? It's never defined; is that a placeholder for us to fill in? I'd set it to "$HOME/.npm" or something.
alias='$EDITOR ~/.bashrc ; source ~/.bashrc' sets a variable called alias, which you never use (and it'd be a weird name!) so I think that's missing an alias name. You have this covered in your "profile" section later, anyway.
These files can get pretty long, and it's common to split out things like aliases to another file:
[-f"$HOME/.bash_aliases"]&&."$HOME/.bash_aliases"
Recently I've started calling this file .aliases and sharing it between zsh and bash so it works on any of my usual environments. Aliases are rarely shell-specific.
Your "Change prompt" section doesn't do anything with the prompt - it's more like a MOTD section - and it uses variables that aren't available as standard ("${COLOR_BROWN}"). It's a useful bunch of stats for you - I'd put it into a script or function instead so you can call it whenever you want.
Almost all your aliases are Mac-specific. I'd divide them up into Mac-only and portable. You said this is for Windows as well, you can split up with something like this:
case$OSTYPEin
linux-gnu)alias ls='ls --color --group-directories-first -FhN';;
darwin*)alias ls='ls -FhG';;*)# I guess do whatever Windows needs?;;esac
You probably shouldn't alias .:
alias .='open -a Finder ./'
This shadows the . (source) command, so you'll no longer be able to do things like . ~/.bash_profile to reload your profile!
I'm a passionately curious Software Engineer, specialising in Senior `Front-End` and `Full-Stack` paradigm under Agile Development methodologies.
London, UK @leolanese https://github.com/leolanese
I'm a passionately curious Software Engineer, specialising in Senior `Front-End` and `Full-Stack` paradigm under Agile Development methodologies.
London, UK @leolanese https://github.com/leolanese
Thanks again. It is updated.
If you have any other suggestion, feel free to make a Pull/Request to the GitHub account: github.com/leolanese/bash_profile.git :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I have a few comments:
It's not going to load
.bash_profile
on a lot of systems, depending on where you are and what you're doing (.bashrc
might be used instead).You don't need to create a file before you edit it (if you leave this step out it's less for people to learn).
It looks like your "Windows version setup" is
git
configuration - did you paste this in from an article from your blog or something? On Windows it would be using WSL or Cygwin orgit bash
. I have no experience of the latter, so I don't know what I'm talking about!If you run
clear
right at the start, then it makes the screen neat, but it means you miss any warnings or errors that might have appeared as the shell started up.Why do you want it to beep (
tput bel
) every time your open a new shell?What's
$dir
? in thenpm
section? It's never defined; is that a placeholder for us to fill in? I'd set it to"$HOME/.npm"
or something.alias='$EDITOR ~/.bashrc ; source ~/.bashrc'
sets a variable calledalias
, which you never use (and it'd be a weird name!) so I think that's missing an alias name. You have this covered in your "profile" section later, anyway.These files can get pretty long, and it's common to split out things like aliases to another file:
Recently I've started calling this file
.aliases
and sharing it betweenzsh
andbash
so it works on any of my usual environments. Aliases are rarely shell-specific.Your "Change prompt" section doesn't do anything with the prompt - it's more like a MOTD section - and it uses variables that aren't available as standard (
"${COLOR_BROWN}"
). It's a useful bunch of stats for you - I'd put it into a script or function instead so you can call it whenever you want.Almost all your aliases are Mac-specific. I'd divide them up into Mac-only and portable. You said this is for Windows as well, you can split up with something like this:
You probably shouldn't alias
.
:This shadows the
.
(source
) command, so you'll no longer be able to do things like. ~/.bash_profile
to reload your profile!I really appretiate your feedback, I will be working with it to improve this post.
Thanks again. It is updated.
If you have any other suggestion, feel free to make a Pull/Request to the GitHub account: github.com/leolanese/bash_profile.git :)