-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathshared.sh
More file actions
63 lines (57 loc) · 1.67 KB
/
Copy pathshared.sh
File metadata and controls
63 lines (57 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Portable config shared by both the bash and zsh entry points.
# Sourced by init.bash and init.zsh, which each set $BASHRC_DIR first.
# Keep everything in here POSIX / dual-shell compatible.
# Local, unversioned init.
if [ -f "$BASHRC_DIR/init-local.sh" ]
then
source "$BASHRC_DIR/init-local.sh"
fi
# Aliases.
alias ..="cd .."
alias cd..="cd .."
alias sr="screen -r"
alias ll="ls -alF"
alias la="ls -A"
alias l="ls -CF"
alias gr="egrep -r"
alias brc="vim ~/src/bashrc/shared.sh"
alias brcl="vim ~/src/bashrc/init-local.sh"
alias k="kill %%"
alias r="bundle exec rspec"
alias n="npm run start"
alias nt="npm test"
alias beg="bundle exec guard"
# Git.
alias gca="git commit -a"
alias gb="git branch"
alias gd="git diff"
alias gdc="git diff --cached"
alias gch="git checkout"
alias gpom="git pull origin main"
alias gp="git pull"
alias gs="git status"
alias gbddd="git branch --merged | grep -v '\*' | grep -v '^ main$' | xargs -n 1 git branch -d"
# Common repos.
alias s="cd ~/src"
alias sgo="cd ~/src/go/src"
alias sb="cd ~/src/bashrc"
# Misc.
alias dc="docker-compose"
alias ember="./node_modules/ember-cli/bin/ember"
# Go path.
export GOPATH=$HOME/src/go/
export PATH=$PATH:$GOPATH/bin
# Setup ssh-agent.
if [[ $OSTYPE == 'linux-gnu' ]]; then
# Ensure the .ssh directory exists and has correct permissions
mkdir -p ~/.ssh
chmod 700 ~/.ssh
# Start agent only if it's not running OR if the config file is missing
if ! pgrep -x ssh-agent > /dev/null || [ ! -f ~/.ssh/agent_config.sh ]; then
ssh-agent -s > ~/.ssh/agent_config.sh 2>&1
fi
# Only evaluate if the file exists and is not empty
if [ -s ~/.ssh/agent_config.sh ]; then
eval "$(cat ~/.ssh/agent_config.sh)"
fi
fi