Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # Bold + purple (06) for labels
- LABEL_COLOR=$'\002\00306' # ^B then ^C06
- RESET_COLOR=$'\017' # ^O
- host=$(hostname)
- distro=$(awk -F= '$1=="PRETTY_NAME"{gsub(/"/,"",$2); print $2}' /etc/os-release)
- {
- # First line: Host + Distro (no Kernel here)
- printf 'Host: %s Distro: %s\n' "$host" "$distro"
- # Then your normal inxi summary
- inxi -c0 2>/dev/null
- } | awk -v L="$LABEL_COLOR" -v R="$RESET_COLOR" '
- {
- # Color only the labels, leave values plain
- for (i=1; i<=NF; i++) {
- if ($i ~ /^(Host:|Distro:|Kernel:|CPU:|Up:|Mem:|Storage:|Procs:|Shell:|Client:|inxi:)$/) {
- $i = L $i R
- }
- }
- # Collapse everything into one line with trailing quote like your original
- if (NR > 1)
- out = out "\" " $0
- else
- out = $0
- }
- END {
- print out "\""
- }
- '
Advertisement