mirror of
https://github.com/nikdoof/dotfiles.git
synced 2025-12-13 17:52:26 +00:00
Add bash functions
This commit is contained in:
8
bash/.bash_aliases
Normal file
8
bash/.bash_aliases
Normal file
@@ -0,0 +1,8 @@
|
||||
# OSX aliases
|
||||
if [ $(uname) == "Darwin" ]; then
|
||||
alias ls="ls -FG"
|
||||
else
|
||||
alias ls="ls -F --color=auto"
|
||||
fi
|
||||
|
||||
alias tma="tmux attach"
|
||||
28
bash/.bash_functions
Normal file
28
bash/.bash_functions
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
# Git pulls latest dotfiles
|
||||
function update-dotfiles() {
|
||||
if [ -d "${HOME}/.dotfiles" ]; then
|
||||
cd $HOME/.dotfiles
|
||||
git pull --rebase --autostash
|
||||
fi
|
||||
if [ -d "${HOME}/.dotfiles-private" ]; then
|
||||
cd $HOME/.dotfiles-private
|
||||
git pull --rebase --autostash
|
||||
fi
|
||||
}
|
||||
|
||||
function add-sshkey() {
|
||||
TIMEOUT="1h"
|
||||
NAME=$1
|
||||
|
||||
if [ -z "$NAME" ]; then
|
||||
echo "Current Keys"
|
||||
ssh-add -L
|
||||
else
|
||||
if [ -f "~/.ssh/id_ed25519_${NAME}" ]; then
|
||||
ssh-add -t $TIMEOUT "~/.ssh/id_ed25519_${NAME}"
|
||||
else
|
||||
echo "No key named ${NAME} found..."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
22
bash/.bashrc
22
bash/.bashrc
@@ -5,18 +5,16 @@ if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
# Source functions, if it exists
|
||||
if [ -e $HOME/.bash_functions ]; then
|
||||
source $HOME/.bash_functions
|
||||
fi
|
||||
|
||||
# Source aliases, if it exists
|
||||
if [ -e $HOME/.bash_aliases ]; then
|
||||
source $HOME/.bash_aliases
|
||||
fi
|
||||
|
||||
# User specific environment
|
||||
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
|
||||
export PATH
|
||||
|
||||
# Uncomment the following line if you don't like systemctl's auto-paging feature:
|
||||
# export SYSTEMD_PAGER=
|
||||
|
||||
# User specific aliases and functions
|
||||
|
||||
# OSX aliases
|
||||
if [ $(uname) == "Darwin" ]; then
|
||||
alias ls="ls -FG"
|
||||
else
|
||||
alias ls="ls -F --color=auto"
|
||||
fi
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
TIMEOUT="1h"
|
||||
NAME=$1
|
||||
|
||||
if [ -z "$NAME" ]; then
|
||||
ssh-add -L
|
||||
else
|
||||
if [ -f "~/.ssh/id_ed25519_${NAME}" ]; then
|
||||
ssh-add -t $TIMEOUT "~/.ssh/id_ed25519_${NAME}"
|
||||
else
|
||||
echo "No key named ${NAME} found..."
|
||||
fi
|
||||
fi
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -d "${HOME}/.dotfiles" ]; then
|
||||
cd $HOME/.dotfiles
|
||||
git pull --rebase --autostash
|
||||
fi
|
||||
if [ -d "${HOME}/.dotfiles-private" ]; then
|
||||
cd $HOME/.dotfiles-private
|
||||
git pull --rebase --autostash
|
||||
fi
|
||||
Reference in New Issue
Block a user