Hi All, Just for fun I was trying to make a very simple Neofetch equivalent in bash.
Neofetch - https://github.com/dylanaraps/neofetch and this was before I found screenfetch https://github.com/KittyKatt/screenFetch I managed to get #!/bin/bash totalmem=$(free -m | grep -oP '\d+' | head -n 1) currmem=$(free -m | grep -oP '\d+' | head -n 2 | tail -1) echo "$(whoami)@$(hostname)" echo "Distro: $(hostnamectl | grep Operating| cut -d" " -f3-)" echo "Kernel: $(uname -r)" echo "Uptime $(uptime -p | cut -d" " -f2-)" echo "Shell: $SHELL" echo "Processes: $(ps -e | wc -l)" echo "Memory: $currmem | $totalmem" echo "Resolution: $(xrandr --current | grep "[*]" | uniq | awk '{print $1}')" echo "WM: $XDG_CURRENT_DESKTOP" echo "Terminal: $TERM" echo "Terminal Font: $(grep FONTFACE < /etc/default/console-setup | cut -d '"' -f 2)" echo "CPU: $(grep name < /proc/cpuinfo | head -n1 | tr -s ' ' | cut -d" " -f3-)" echo "GPU: $(lspci | grep VGA | head -n1 | cut -d" " -f5-)" echo -e "\e[30m\u2588\e[31m\u2588\e[32m\u2588\e[33m\u2588\e[34m\u2588\e[35m\u2588\e[36m\u2588\e[37m\u2588\e[0m" echo -e "\e[1;30m\u2588\e[1;31m\u2588\e[1;32m\u2588\e[1;33m\u2588\e[1;34m\u2588\e[1;35m\u2588\e[1;36m\u2588\e[1;37m\u2588\e[0m" Is there anything I should obviously avoid in the above? I did start to remove echo and replace with printf but I think echo -e is allowed everywhere these days. Is there any information that is missing such as Display server. I think the code for that would be if [[ -z "$WAYLAND_DISPLAY" ]] then echo "Display Server:$XDG_SESSION_TYPE" else echo "Display Server:$WAYLAND_DISPLAY" fi The last two lines change the ink colour with \e[nnm and print a unicode full block \u2588 and finally reset ink colour to default with \e[0m The \e[1;nnm just switches on bold for that colour. I initially had difficulties because in my case Gnome-Terminal sets the default yellow to be a light brown colour if running without a profile but XTerm was fine. Regards John _______________________________________________ Sheffield Linux User's Group http://sheflug.org.uk/mailman/listinfo/sheflug_sheflug.org.uk FAQ at: http://www.sheflug.org.uk/mailfaq.html GNU - The Choice of a Complete Generation
