-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate_packages.sh
More file actions
39 lines (36 loc) · 853 Bytes
/
update_packages.sh
File metadata and controls
39 lines (36 loc) · 853 Bytes
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
#!/bin/bash
# Function to check if a command is available, kinda clunky but w/e
check_command() {
command -v "$1" >/dev/null 2>&1
}
# Function to update all the things
udpate() {
echo "Updating..."
if check_command "apt-get"; then
echo "Updating apt-get..."
sudo apt-get update
fi
if check_command "yum"; then
echo "Updating yum..."
sudo yum update
fi
if check_command "brew"; then
echo "Updating brew..."
brew tap --repair
brew update
fi
if check_command "npm"; then
echo "Updating npm..."
npm update -g
fi
if check_command "pip"; then
echo "Updating pip..."
pip install --upgrade pip
fi
if check_command "gem"; then
echo "Updating gem..."
gem update
fi
echo "Update finished"
}
update