-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_functions.sh
executable file
·38 lines (38 loc) · 1.03 KB
/
.bash_functions.sh
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
cdc() {
for fn in "$@"; do
for fn do
if [[ "${fn##*/}" == .* ]]
then
source-highlight --src-lang=sh --out-format=esc -i "$fn"
else
source-highlight --out-format=esc -i "$fn"
fi 2> /dev/null || /bin/cat "$fn"
done
done; }; alias cat='cdc' # Keep cat alias here by (cdc) function definition
md () {
[ $# = 1 ] && mkdir -p "$@" && cd "$@" || echo "Error - no directory passed!"
}
bup () {
if [[ ! -f ~/$1 ]]
then
echo "Error - file does not exist"
return
fi
[ $# = 1 ] && {
cp -v ~/$1 ~/Dropnot/setups
#install -d -v ~/$1 ~/Dropnot/setups/$1 # attempt to avoid no dir issue
cd ~/Dropnot/setups
git fetch
git merge origin/master
git add $1
git commit -m"$1 update"
git push origin master
cp -v $1 ~
cd -; } || echo "Error - no filename passed!"
}
git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
newalias() {
echo "alias ${1}" >> $HOME/.bash_aliases; source ~/.bash_aliases;
}