Skip to content

Commit d0e8235

Browse files
Create Setup_bashrc.sh
1 parent 9f527cf commit d0e8235

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

Setup_bashrc.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
if [ "$0" == "$BASH_SOURCE" ]; then
3+
echo >&2 "Setup script has to be sourced, not run with sh. Aborting..."
4+
exit 1
5+
fi
6+
if [ ! -e ~/.sp ] ; then
7+
touch ~/.sp
8+
fi
9+
if [ $(uname -o) == "Cygwin" ]; then
10+
(set -o igncr) 2>/dev/null && set -o igncr;
11+
fi
12+
echo "
13+
################################################################################
14+
#Hide user name and host in terminal
15+
#export PS1="\w$ "
16+
#Make ls every time a terminal opens
17+
ls
18+
#cd + ls
19+
function cs () {
20+
cd \$1
21+
ls -a
22+
}
23+
#transfer path: save the current path to a hidden file
24+
function tp () {
25+
pwd > ~/.sp
26+
}
27+
#goto transfer path: goes where the previously saved tp points
28+
function gtp () {
29+
cs \`cat ~/.sp\`
30+
}
31+
#cat with color
32+
function ccat () {
33+
source-highlight -fesc -i \$1
34+
}
35+
#Remove trash from terminal and runs program in background
36+
function evince () {
37+
/usr/bin/evince \$* 2> /dev/null & disown
38+
}
39+
function gedit (){
40+
/usr/bin/gedit \$* 2> /dev/null & disown
41+
}
42+
# up N: moves N times upwards (cd ../../../{N})
43+
function up () {
44+
LIMIT=\$1
45+
P=\$PWD
46+
for ((i=1; i <= LIMIT; i++))
47+
do
48+
P=\$P/..
49+
done
50+
cs \$P
51+
export MPWD=\$P
52+
}
53+
" >> ~/.bashrc
54+
source ~/.bashrc
55+
if [ $(uname -o) == "Cygwin" ]; then
56+
if [ command -v dos2unix >/dev/null 2>&1 ]; then
57+
dos2unix $INTENDED_BASH_PATH
58+
fi
59+
fi
60+
if [ ! -f ~/.bash_profile ]; then
61+
echo ".bash_profile not found. Creating..."
62+
echo "
63+
# include .bashrc if it exists
64+
if [ -f "\$HOME/.bashrc" ]; then
65+
. "\$HOME/.bashrc"
66+
fi
67+
" > ~/.bash_profile
68+
fi
69+
echo ".bashrc updated!"

0 commit comments

Comments
 (0)