Scripting

Easy Environment Setup

The Copy/Paste environment setup

Below is a way to set up a profile of aliases and more particularly environment variables that can be set up ready to be included in your startup scripts as well as in custom or crontab scripts.

Copy/Paste this directly into a bash terminal. You will then need to edit the created file (~/bin/my_env) to alter the bits with 'changeme' in there.

Obviously add your own variables and aliases in there too!


if ! [ -d ~/bin ]; then
mkdir ~/bin
export PATH="~/bin:$PATH"
fi

cat > ~/bin/my_env <<EOF
export P4PORT=changeme:1666
export P4CHARSET=utf8
export P4CLIENT=changeme
export P4USER=changeme

export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc
export FREETDSCONF=/etc/freetds/freetds.conf
export RUBYOPTS=rubygems

alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias vis='vim -S project.session'

# Put current git branch in bash prompt
export PS1='\u@\h:\w$(__git_ps1 " (%s)") \$ '

export PATH=$PATH:/var/lib/gems/1.8/bin/:/home/jezm/programs/android-sdk/tools/
EOF

echo . ~/bin/my_env >> ~./bashrc

echo 'done.'

You can add any other env vars to this.