Last active
August 31, 2016 05:13
-
-
Save xCASx/2245b56d9aeb62dd4518a0535edb3a84 to your computer and use it in GitHub Desktop.
Customized bash profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To the extent possible under law, the author(s) have dedicated all | |
# copyright and related and neighboring rights to this software to the | |
# public domain worldwide. This software is distributed without any warranty. | |
# You should have received a copy of the CC0 Public Domain Dedication along | |
# with this software. | |
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | |
# base-files version 4.2-3 | |
# ~/.bashrc: executed by bash(1) for interactive shells. | |
# The latest version as installed by the Cygwin Setup program can | |
# always be found at /etc/defaults/etc/skel/.bashrc | |
# Modifying /etc/skel/.bashrc directly will prevent | |
# setup from updating it. | |
# The copy in your home directory (~/.bashrc) is yours, please | |
# feel free to customise it to create a shell | |
# environment to your liking. If you feel a change | |
# would be benifitial to all, please feel free to send | |
# a patch to the cygwin mailing list. | |
# User dependent .bashrc file | |
# If not running interactively, don't do anything | |
[[ "$-" != *i* ]] && return | |
# Shell Options | |
# | |
# See man bash for more options... | |
# | |
# Don't wait for job termination notification | |
# set -o notify | |
# | |
# Don't use ^D to exit | |
# set -o ignoreeof | |
# | |
# Use case-insensitive filename globbing | |
# shopt -s nocaseglob | |
# | |
# Make bash append rather than overwrite the history on disk | |
# shopt -s histappend | |
# | |
# When changing directory small typos can be ignored by bash | |
# for example, cd /vr/lgo/apaache would find /var/log/apache | |
# shopt -s cdspell | |
# Completion options | |
# | |
# These completion tuning parameters change the default behavior of bash_completion: | |
# | |
# Define to access remotely checked-out files over passwordless ssh for CVS | |
# COMP_CVS_REMOTE=1 | |
# | |
# Define to avoid stripping description in --option=description of './configure --help' | |
# COMP_CONFIGURE_HINTS=1 | |
# | |
# Define to avoid flattening internal contents of tar files | |
# COMP_TAR_INTERNAL_PATHS=1 | |
# | |
# Uncomment to turn on programmable completion enhancements. | |
# Any completions you add in ~/.bash_completion are sourced last. | |
# [[ -f /etc/bash_completion ]] && . /etc/bash_completion | |
# History Options | |
# | |
# Don't put duplicate lines in the history. | |
# export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups | |
# | |
# Ignore some controlling instructions | |
# HISTIGNORE is a colon-delimited list of patterns which should be excluded. | |
# The '&' is a special pattern which suppresses duplicate entries. | |
# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit' | |
# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit:ls' # Ignore the ls command as well | |
# | |
# Whenever displaying the prompt, write the previous line to disk | |
# export PROMPT_COMMAND="history -a" | |
# Aliases | |
# | |
# Some people use a different file for aliases | |
# if [ -f "${HOME}/.bash_aliases" ]; then | |
# source "${HOME}/.bash_aliases" | |
# fi | |
# | |
# Some example alias instructions | |
# If these are enabled they will be used instead of any instructions | |
# they may mask. For example, alias rm='rm -i' will mask the rm | |
# application. To override the alias instruction use a \ before, ie | |
# \rm will call the real rm not the alias. | |
# | |
# Interactive operation... | |
# alias rm='rm -i' | |
# alias cp='cp -i' | |
# alias mv='mv -i' | |
# | |
# Default to human readable figures | |
# alias df='df -h' | |
# alias du='du -h' | |
# | |
# Misc :) | |
# alias less='less -r' # raw control characters | |
# alias whence='type -a' # where, of a sort | |
# alias grep='grep --color' # show differences in colour | |
# alias egrep='egrep --color=auto' # show differences in colour | |
# alias fgrep='fgrep --color=auto' # show differences in colour | |
# | |
# Some shortcuts for different directory listings | |
# alias ls='ls -hF --color=tty' # classify files in colour | |
# alias dir='ls --color=auto --format=vertical' | |
# alias vdir='ls --color=auto --format=long' | |
# alias ll='ls -l' # long list | |
# alias la='ls -A' # all but . and .. | |
# alias l='ls -CF' # | |
# Umask | |
# | |
# /etc/profile sets 022, removing write perms to group + others. | |
# Set a more restrictive umask: i.e. no exec perms for others: | |
# umask 027 | |
# Paranoid: neither group nor others have any perms: | |
# umask 077 | |
# Functions | |
# | |
# Some people use a different file for functions | |
# if [ -f "${HOME}/.bash_functions" ]; then | |
# source "${HOME}/.bash_functions" | |
# fi | |
# | |
# Some example functions: | |
# | |
# a) function settitle | |
# settitle () | |
# { | |
# echo -ne "\e]2;$@\a\e]1;$@\a"; | |
# } | |
# | |
# b) function cd_func | |
# This function defines a 'cd' replacement function capable of keeping, | |
# displaying and accessing history of visited directories, up to 10 entries. | |
# To use it, uncomment it, source this file and try 'cd --'. | |
# acd_func 1.0.5, 10-nov-2004 | |
# Petar Marinov, http:/geocities.com/h2428, this is public domain | |
# cd_func () | |
# { | |
# local x2 the_new_dir adir index | |
# local -i cnt | |
# | |
# if [[ $1 == "--" ]]; then | |
# dirs -v | |
# return 0 | |
# fi | |
# | |
# the_new_dir=$1 | |
# [[ -z $1 ]] && the_new_dir=$HOME | |
# | |
# if [[ ${the_new_dir:0:1} == '-' ]]; then | |
# # | |
# # Extract dir N from dirs | |
# index=${the_new_dir:1} | |
# [[ -z $index ]] && index=1 | |
# adir=$(dirs +$index) | |
# [[ -z $adir ]] && return 1 | |
# the_new_dir=$adir | |
# fi | |
# | |
# # | |
# # '~' has to be substituted by ${HOME} | |
# [[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}" | |
# | |
# # | |
# # Now change to the new dir and add to the top of the stack | |
# pushd "${the_new_dir}" > /dev/null | |
# [[ $? -ne 0 ]] && return 1 | |
# the_new_dir=$(pwd) | |
# | |
# # | |
# # Trim down everything beyond 11th entry | |
# popd -n +11 2>/dev/null 1>/dev/null | |
# | |
# # | |
# # Remove any other occurence of this dir, skipping the top of the stack | |
# for ((cnt=1; cnt <= 10; cnt++)); do | |
# x2=$(dirs +${cnt} 2>/dev/null) | |
# [[ $? -ne 0 ]] && return 0 | |
# [[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}" | |
# if [[ "${x2}" == "${the_new_dir}" ]]; then | |
# popd -n +$cnt 2>/dev/null 1>/dev/null | |
# cnt=cnt-1 | |
# fi | |
# done | |
# | |
# return 0 | |
# } | |
# | |
# alias cd=cd_func | |
function branch { | |
alias biz="settitle Biz $1; ./ant tcbiz1start" | |
alias view="settitle View $1; ./ant tcview1start" | |
alias biz-test="settitle Biz Test $1; ./ant tcbiz1teststart" | |
alias view-test="settitle View Test $1; ./ant tcview1teststart" | |
alias biz-debug="settitle Biz Debug $1; ./ant tcbiz1debugstart" | |
alias view-debug="settitle View Debug $1; ./ant tcview1debugstart" | |
alias stop="./ant stopTomcat; settitle $1" | |
alias stopView="./shutdown-tomcat view 1; settitle $1" | |
alias stopBiz="./shutdown-tomcat biz 1; settitle $1" | |
alias rebuild="./ant clean compile clientFiles syncCsv" | |
alias jcache="./ant startLocalJcacheServer" | |
alias factsTT="./jspringjob RefreshCacheJob factsTravel" | |
alias refresh="./jrunjob RefreshConfigurationJob ui" | |
alias clearLibs="rm -rf ../../../3p/*" | |
alias p4sync="~/p4sync.sh" | |
cd /p4/phoenix/$1/build | |
settitle $1 | |
echo "Switched context to '$1'. Run 'alias' to see aliases created for this branch." | |
} | |
function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; } | |
echo "Run 'branch [branch name]' to set up aliases, e.g. 'branch 2011.02' or 'branch main'." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To the extent possible under law, the author(s) have dedicated all | |
# copyright and related and neighboring rights to this software to the | |
# public domain worldwide. This software is distributed without any warranty. | |
# You should have received a copy of the CC0 Public Domain Dedication along | |
# with this software. | |
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | |
# base-files version 4.2-3 | |
# ~/.profile: executed by the command interpreter for login shells. | |
# The latest version as installed by the Cygwin Setup program can | |
# always be found at /etc/defaults/etc/skel/.profile | |
# Modifying /etc/skel/.profile directly will prevent | |
# setup from updating it. | |
# The copy in your home directory (~/.profile) is yours, please | |
# feel free to customise it to create a shell | |
# environment to your liking. If you feel a change | |
# would be benificial to all, please feel free to send | |
# a patch to the cygwin mailing list. | |
# User dependent .profile file | |
# Set user-defined locale | |
export LANG=$(locale -uU) | |
# This file is not read by bash(1) if ~/.bash_profile or ~/.bash_login | |
# exists. | |
# | |
# if running bash | |
if [ -n "${BASH_VERSION}" ]; then | |
if [ -f "${HOME}/.bashrc" ]; then | |
source "${HOME}/.bashrc" | |
fi | |
fi | |
######################################### | |
export SHELLOPTS | |
set -o igncr | |
#export GREP_COLOR='00;38;5;157' | |
#export GREP_COLOR='00;38;5;226' | |
#export GREP_OPTIONS='--color=auto' | |
#export P4MERGE=/progra~2/WinMerge/winmer~1.exe | |
# Show currnt Git branch | |
function git-branch-name { | |
git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3 | |
} | |
function git-branch-prompt { | |
local branch=`git-branch-name` | |
if [ $branch ]; then printf " [%s]" $branch; fi | |
} | |
#PS1="\u@\h \[\033[0;36m\]\W\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[0m\] \$ " | |
# Define colors: | |
red='\e[0;31m' | |
RED='\e[1;31m' | |
green='\e[0;32m' | |
GREEN='\e[1;32m' | |
yellow='\e[0;33m' | |
YELLOW='\e[1;33m' | |
blue='\e[0;34m' | |
BLUE='\e[1;34m' | |
pink='\e[0;35m' | |
PINK='\e[1;35m' | |
NC='\e[0m' | |
# Colors and Prompt | |
#export PS1="\[\e]2;\u@\h:\w\007$green\]\u@\h:\[$pink\]\w\[$GREEN\]$ \[$green\]" | |
#export PS1="\[\e]2;\w\007$green\]\[$pink\]\w\[\033[0;32m\]\$(git-branch-prompt)\[$GREEN\]$ \[$green\]" | |
export PS1="\[$pink\]\W\[\033[0;32m\]\$(git-branch-prompt)\[$GREEN\]$ \[$green\]" | |
######################################### | |
# ssh-agent. source: http://mah.everybody.org/docs/ssh | |
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initialising new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null | |
/usr/bin/ssh-add; | |
} | |
# Source SSH settings, if applicable | |
if [ -f "${SSH_ENV}" ]; then | |
. "${SSH_ENV}" > /dev/null | |
#ps ${SSH_AGENT_PID} doesn't work under cywgin | |
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { | |
start_agent; | |
} | |
else | |
start_agent; | |
fi | |
######################################### | |
alias refresh='./jrunjob RefreshCacheJob $1' | |
#CHEF (fix for RUBY related issue) | |
alias knife='/cygdrive/c/dev/tools/opscode/chefdk/embedded/bin/ruby C:/dev/tools/opscode/chefdk/bin/knife' | |
alias chef-client='/cygdrive/c/dev/tools/opscode/chefdk/embedded/bin/ruby C:/dev/tools/opscode/chefdk/bin/chef-client' | |
alias chef-solo='/cygdrive/c/dev/tools/opscode/chefdk/embedded/bin/ruby C:/dev/tools/opscode/chefdk/bin/chef-solo' | |
alias shef='/cygdrive/c/dev/tools/opscode/chefdk/embedded/bin/ruby C:/dev/tools/opscode/chefdk/bin/shef' | |
alias berks='/cygdrive/c/dev/tools/opscode/chefdk/embedded/bin/ruby C:/dev/tools/opscode/chefdk/bin/berks' | |
alias kitchen='/cygdrive/c/dev/tools/opscode/chefdk/embedded/bin/ruby C:/dev/tools/opscode/chefdk/bin/kitchen' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
p4 sync "//depot/3rdparty/..." | |
p4 sync "//depot/tools/..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment