forked from ZTF666/SH.AMA-Lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shama-lite.sh
80 lines (66 loc) · 2.48 KB
/
shama-lite.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# Hello !
# This is a simple/minimal script
# To fetch some basic information about your system
# I made this for my own personal use
# It is limited as you can see
# It's my own take on neofetch but less flashy and less fancy lol
# I understand that my code isn't 5* quality ,so yeah ...
# I only tested it on Kali and Ubuntu
# On other distros some commands won't work
# So please feel free to change whatever command
# Does not work with the appropriate one for your system .
#Colors
grey="\033[0;37m"
purple="\033[0;35m"
red="\033[1;31m"
green="\033[1;32m"
yellow="\033[1;33m"
transparent="\e[0m"
#Commands & variables
#OS
osTemp="$(cat /etc/os-release | grep "ID" | head -1)"
readarray -d = -t strarr <<< $osTemp
#removing trailing spaces
os="$(echo -e "${strarr[1]}" | sed -e 's/[[:space:]]*$//')"
#CPU info
cpuTemp="$(cat /proc/cpuinfo | grep 'model name' |uniq)"
readarray -d : -t strarrcpu <<< $cpuTemp
cpu="$(echo -e "${strarrcpu[1]}" | tr -d '[:space:]')"
#RAM info
ramTemp="$(cat /proc/meminfo | grep 'MemTotal')"
readarray -d : -t strarrram <<< $ramTemp
#trim white spaces and removes the kB at the end so it can be displayed as Mb afterwards
ramx="$(echo -e "${strarrram[1]}" | tr -d '[:space:]' | sed 's/..$//' )"
ram=$((ramx / 1000))
#Hostname
host="$(cat /proc/sys/kernel/hostname)"
#Number of packages installed (everything included)
pkgs="$(dpkg --get-selections | wc --lines)"
#Uptime
up="$(uptime | awk -F'( |,|:)+' '{d=h=m=0; if ($7=="min") m=$6; else {if ($7~/^day/) {d=$6;h=$8;m=$9} else {h=$6;m=$7}}} {print d+0,"d,",h+0,"h,",m+0,"m."}')"
# Main function
Shama(){
while true;
do
#echo ""
echo -e " "$green"——-"$purple"SH"$red"."$purple"AMA"$green"-——"
echo -e ""
echo -e " "$green"|"$purple"■"$grey" OS " $red":" $grey" ${os^^} "
echo -e " "$purple"|"$green"■"$grey" UP " $red":" $grey" ${up} "
echo -e " "$green"|"$purple"■"$grey" CPU " $red":" $grey" ${cpu^^} "
echo -e " "$purple"|"$green"■"$grey" RAM " $red":" $grey" ${ram}Mb "
echo -e " "$green"|"$purple"■"$grey" HOST " $red":" $grey" ${host^^} "
echo -e " "$purple"|"$green"■"$grey" PKGS " $red":" $grey" ${pkgs} "
echo ""
break;
done
echo
}
#Logo
echo -e ""
echo -e " |\_/|"
echo -e " '"$yellow"o"$transparent"."$yellow"o"$transparent"'"
echo -e " > ^ <"
# Main function init
Shama;