forked from cowboy/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
50_ubuntu.sh
33 lines (30 loc) · 1.03 KB
/
50_ubuntu.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
# Ubuntu-only stuff. Abort if not Ubuntu.
is_ubuntu || return 1
# Package management
alias update="sudo apt-get -qq update && sudo apt-get upgrade"
alias install="sudo apt-get install"
alias remove="sudo apt-get remove"
alias search="apt-cache search"
# Make 'less' more.
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Switch between already-downloaded node versions.
function node_ver() {
(
ver="${1#v}"
nodes=()
if [[ ! -e "/usr/local/src/node-v$ver" ]]; then
shopt -s extglob
shopt -s nullglob
cd "/usr/local/src"
eval 'for n in node-v*+([0-9]).+([0-9]).+([0-9]); do nodes=("${nodes[@]}" "${n#node-}"); done'
[[ "$1" ]] && echo "Node.js version \"$1\" not found."
echo "Valid versions are: ${nodes[*]}"
[[ "$(type -P node)" ]] && echo "Current version is: $(node --version)"
exit 1
fi
cd "/usr/local/src/node-v$ver"
sudo make install >/dev/null 2>&1 &&
echo "Node.js $(node --version) installed." ||
echo "Error, $(node --version) installed."
)
}