blob: 73233395eadb00b985f93d9b97c7daf657309a6b (
plain)
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
|
#!/bin/sh
# Simple Ass Fetch by futxlii
cyan="$(printf '\033[36m')"
blue="$(printf '\033[34m')"
reset="$(printf '\033[0m')"
load ()
{
# take everything after 'load average: ' then remove '0.' or '.' or ','
# from output, this multiplies by hundred, so we can divide an integer
# instead of a fraction (which dash can't do)
for time in $(uptime | sed -e 's/^.*load average://' -e 's/0\?\.\|,//g')
do printf "%s%%\n" "$((time/$(nproc)))"
done | xargs
}
for file in /etc/os-release /usr/lib/os-release
do
[ -f "$file" ] && . "$file" && break
done
KERNEL="$(uname -r)"
UPTIME="$(uptime -p)"; UPTIME="${UPTIME##up }"
SHELL="$(basename "$SHELL")"
MEMORY_USED="$(free --bytes | awk 'NR==2 {print $3}' | numfmt --to=iec-i --format '%.2f')"
MEMORY_TOTAL="$(free --bytes | awk 'NR==2 {print $2}' | numfmt --to=iec-i --format '%.2f')"
cat <<EOF
${blue}OS: ${cyan}${NAME:-"unknown"}
${blue}Kernel: ${cyan}$KERNEL
${blue}Desktop: ${cyan}$XDG_CURRENT_DESKTOP${reset}
${blue}Shell: ${cyan}$SHELL${reset}
${blue}Memory: ${cyan}$MEMORY_USED / $MEMORY_TOTAL
${blue}Uptime: ${cyan}$UPTIME ($(load))
EOF
|