Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write your own screenfetch script
#1
Hi everyone,

It has been a while since I have been online here and I just wanted to share a fun little project I had been working on over the last day or so.  Ufetch has been a popular subject among other linux channels and it is way faster and more minimal than screenfetch, but i wanted features from screenfetch and the speed of ufetch, so I wrote my own little  terminal information fetcher script.

It is Debian Specific, but it can easily be changed to work with your distro of choice. I will post a link to the quick little video I made about it as well as a link to my GitHub page if you are interested in checking it out or taking it and making it your own.

I am neither a developer nor an expert, so if you do check it out and notice something I could have written better, please feel free to let me know.  Any and all feedback is appreciated.

Github Page:
https://github.com/linuxdabbler/debinfo

Video:
https://youtu.be/5JMGolvkQjA


Thanks,

LD


Edit:  I did go back and revise the code while writing this post to remove the "( )" from the output.
Reply
#2
Thanks for sharing! I have a script that extracts basic system information and writes it to a file in my home directory which I find useful as a reference. I'm always looking for different ways to extract the information and, hopefully, make my script more efficient or at least display it nicer.

Your methods to get the CPU model and memory information served as a launching point to try new approaches in my script In Linux, there is always more than one way to do something.
Reply
#3
I totally agree... And I'm glad it gave you some ideas for your script. There may be a better way of doing what I did. So if someone sees anything I could do better or more efficiently, please let me know.

Thank you

LD
Reply
#4
That is the cool thing I like about Linux... There are more that one way to get the same thing done... Linuxdabblers project help me with one of mine as his way of getting the CPU info was way better that the way I was doing it...LOL Big Grin
LLAP
**********************************************************
Taglines of the BBS Days:
Today is the tomorrow you worried about yesterday. 
  Everybody remember where we parked. - Kirk
    Not everything in life is a 1 or a 0.
       Experience enables you to recognise a mistake when you make it again...
Reply
#5
(10-02-2019, 11:25 AM)Linuxdabbler Wrote: Hi everyone,

It has been a while since I have been online here and I just wanted to share a fun little project I had been working on over the last day or so.  Ufetch has been a popular subject among other linux channels and it is way faster and more minimal than screenfetch, but i wanted features from screenfetch and the speed of ufetch, so I wrote my own little  terminal information fetcher script.

It is Debian Specific, but it can easily be changed to work with your distro of choice. I will post a link to the quick little video I made about it as well as a link to my GitHub page if you are interested in checking it out or taking it and making it your own.

I am neither a developer nor an expert, so if you do check it out and notice something I could have written better, please feel free to let me know.  Any and all feedback is appreciated.

Github Page:
https://github.com/linuxdabbler/debinfo

Video:
https://youtu.be/5JMGolvkQjA


Thanks,

LD


Edit:  I did go back and revise the code while writing this post to remove the "( )" from the output.


decent code for the target your looking for.

a little over a year ago I did the same thing. it took a few days, but it was better than  screen fetch, in that it was much snappier. having color doesn't slow it down. i have some suggestions for you

1: first try "neofetch" it has output like screenfetch and is noticeably faster. and could save you many hours of coding.

2: buy if that doesn't work for you, you could try this
Code:
usnm="$(logname)"
user=$USER@
Desktop="${XDG_CURRENT_DESKTOP}"
Kernel="$(uname -sr)"
Uptime="$(uptime -p | sed 's/up //')"
Shell="$(basename "$SHELL")"
CPU="$(lscpu | grep Model\ name | sed 's/name:\ //' | sed "s/([^)]*)/()/g" | sed 's/[)(]//g')"
GPU="$(glxinfo -B | grep Device: | sed "s/([^)]*)/()/g" | sed 's/[)(]//g')"
RAM="$(free -h | awk '/^Mem:/ {print $3 " / " $2}')"



Debian_Linux(){

    c1="\e[37m" # White
    c2="\e[31m" # Light Red
    c3="\e[33m" # Bold Yellow
    c4="\e[0m" # Normal
            
echo "${c1}         _,met\$\$\$\$\$gg.          "     ${c2}$user ${c3}$(hostname)
echo "${c1}      ,g\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$P.       "     ${c2}OS: ${c3}$OS
echo "${c1}    ,g\$\$P\"\"       \"\"\"Y\$\$.\".     "     ${c2}Desktop: ${c3}$Desktop
echo "${c1}   ,\$\$P'              \`\$\$\$.     "     ${c2}Kernel: ${c3}$Kernel
echo "${c1}  ',\$\$P       ,ggs.     \`\$\$b:   "     ${c2}Packages: ${c3}$Packages
echo "${c1}  \`d\$\$'     ,\$P\"\'   ${c2}.${c1}    \$\$\$   "    ${c2}Shell: ${c3}$Shell
echo "${c1}   \$\$P      d\$\'     ${c2},${c1}    \$\$P   "    ${c2}CPU: ${c3}$CPU
echo "${c1}   \$\$:      \$\$.   ${c2}-${c1}    ,d\$\$'    "     ${c2}GPU: ${c3}$GPU
echo "${c1}   \$\$\;      Y\$b._   _,d\$P'     "      ${c2}RAM: ${c3}$RAM
echo "${c1}   Y\$\$.    ${c2}\`.${c1}\`\"Y\$\$\$\$P\"'         "
echo "${c1}   \`\$\$b      ${c2}\"-.__              "
echo "${c1}    \`Y\$\$                        "
echo "${c1}     \`Y\$\$.                      "
echo "${c1}       \`\$\$b.                    "
echo "${c1}         \`Y\$\$b.                 "
echo "${c1}            \`\"Y\$b._             "
echo "${c1}                \`\"\"\"\"           "
echo "${c1}                                ${c4}"

}

Debian_Linux
That gives you your same output but with color. You can play around with it until you find a color set that you like.

If the echo command doesn't work correctly try it with " -e " like
Code:
echo -e "${c1}what you want to print"

also if you have lsb_release installed try changing your $OS variable to
Code:
OS="$(lsb_release -sirc)"
I believe the output is a little more correct.


just some tips i picked up a year ago, passing it along.
I hope that helped,


kudos
A computer without Microsoft is like a piece of chocolate cake without ketchup and mustard.
-
It is okay to not be able to answer a question,
however it should be a crime to not be able to question an answer.

@ArrowLinux
Reply
#6
So i spent most of the night expanding on your script
to make it work on the systems I use. Arch, Ubuntu, Mint, And Peppermint.

I don't use Debian, but you do, and since it is your script I left it in there Wink  lol.
Actually Debian is a great distro.

Anyway here it is. It is your script, I just expanded on it,
leaving the print-out info mostly the same. I mainly did this for learning purposes.
A more detailed explanation is at the end of the post. 

I hope that this is not offensive. 

Code:
#!/usr/bin/env bash
# vim: noai:ts=4:sw=4:expandtab
# shellcheck source=/dev/null
# shellcheck disable=2009

###################################################################################
# This script uses lsb_release, lscpu, and glxinfo. make sure they are installed. #
###################################################################################
#
# START OF SCRIPT
#
#
clear ; clear

# Universal variables
user="${USER}\e[33m@"
Desktop="${XDG_CURRENT_DESKTOP}"
Kernel="$(uname -sr)"
Uptime="$(uptime -p | sed 's/up //')"
Shell="$(basename "$SHELL")"
CPU="$(lscpu | grep Model\ name | sed 's/name:\ //' | sed "s/([^)]*)/()/g" | sed 's/[)(]//g')"
GPU="$(glxinfo -B | grep Device: | sed "s/([^)]*)/()/g" | sed 's/[)(]//g')"
RAM="$(free -h | awk '/^Mem:/ {print $3 " / " $2}')"
OS1="$(lsb_release -si)"
OS="$(lsb_release -sirc)"

# colors
 c1="\e[31m" # Red
 c2="\e[32m" # Light Green
 c3="\e[33m" # Yellow
 c4="\e[34m"  # Calm Blue
 c5="\e[35m" # Violet
 c6="\e[36m" # Arch Blue
 c7="\e[37m" # White
 c8="\e[38m" # Sky Blue
 c9="\e[39m" # Light Grey
 c10="\e[30m" # Dark Grey
 c20="\e[0m" # Normal

# Package count for Debian based systems
Packages_dpkg(){
         
         Packages="$(dpkg -l | grep -c ^i)"
}

# Package count for Arch based systems
Arch_Packages(){

         Packages="$(pacman -Qs | wc -l)"

}

# An Error echo wrapper
err0r()
{

    echo >&2 "$(tput bold; tput setaf 1)[-] ERROR: ${*}$(tput sgr0)"
    echo ""
    exit 86
}

# A Warning echo wrapper
warn()
{
 echo >&2 "$(tput bold; tput setaf 3)[!] WARNING: ${*}$(tput sgr0)"
 echo ""
}

# A Message echo wrapper
msg()
{
 echo "$(tput bold; tput setaf 2)[+] ${*}$(tput sgr0)"
}


Debian_Linux(){

    Packages_dpkg

echo ""
echo -e "${c7}         _,met\$\$\$\$\$gg.          "     ${c1}${user}${c7}$(hostname)
echo -e "${c7}      ,g\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$P.       "     ${c1}OS: ${c7}$OS
echo -e "${c7}    ,g\$\$P\"\"       \"\"\"Y\$\$.\".     "     ${c1}Desktop: ${c7}$Desktop
echo -e "${c7}   ,\$\$P'              \`\$\$\$.     "     ${c1}Kernel: ${c7}$Kernel
echo -e "${c7}  ',\$\$P       ,ggs.     \`\$\$b:   "     ${c1}Packages: ${c7}$Packages
echo -e "${c7}  \`d\$\$'     ,\$P\"\'   ${c1}.${c7}    \$\$\$   "    ${c1}Shell: ${c7}$Shell
echo -e "${c7}   \$\$P      d\$\'     ${c1},${c7}    \$\$P   "    ${c1}CPU: ${c7}$CPU
echo -e "${c7}   \$\$:      \$\$.   ${c1}-${c7}    ,d\$\$'    "     ${c1}GPU: ${c7}$GPU
echo -e "${c7}   \$\$\;      Y\$b._   _,d\$P'     "      ${c1}RAM: ${c7}$RAM
echo -e "${c7}   Y\$\$.    ${c1}\`.${c7}\`\"Y\$\$\$\$P\"'         "
echo -e "${c7}   \`\$\$b      ${c1}\"-.__              "
echo -e "${c7}    \`Y\$\$                        "
echo -e "${c7}     \`Y\$\$.                      "
echo -e "${c7}       \`\$\$b.                    "
echo -e "${c7}         \`Y\$\$b.                 "
echo -e "${c7}            \`\"Y\$b._             "
echo -e "${c7}                \`\"\"\"\"           "
echo -e "${c7}                                ${c20}"
echo ""

}




Ubuntu_Linux(){

    Packages_dpkg
    
echo ""
echo -e "${c1}                          ./+o+-      ${c7}"     ${c1}${user}${c7}$(hostname)
echo -e "${c7}                  yyyyy- ${c1}-yyyyyy+     ${c7}"     ${c1}OS: ${c7}$OS
echo -e "${c7}               ${c7}://+//////${c1}-yyyyyyo     ${c7}"     ${c1}Desktop: ${c7}$Desktop
echo -e "${c3}           .++ ${c7}.:/++++++/-${c1}.+sss/\`     ${c7}"     ${c1}Kernel: ${c7}$Kernel
echo -e "${c3}         .:++o:  ${c7}/++++++++/:--:/-     ${c7}"     ${c1}Packages: ${c7}$Packages
echo -e "${c3}        o:+o+:++.${c7}\`..\`\`\`.-/oo+++++/    ${c7}"     ${c1}Shell: ${c7}$Shell
echo -e "${c3}       .:+o:+o/.${c7}          \`+sssoo+/   ${c7}"     ${c1}CPU: ${c7}$CPU
echo -e "${c7}  .++/+:${c3}+oo+o:\`${c7}             /sssooo.  ${c7}"     ${c1}GPU: ${c7}$GPU
echo -e "${c7} /+++//+:${c3}\`oo+o${c7}               /::--:.  ${c7}"      ${c1}RAM: ${c7}$RAM
echo -e "${c7} \+/+o+++${c3}\`o++o${c1}               ++////.  ${c7}"
echo -e "${c7}  .++.o+${c3}++oo+:\`${c1}             /dddhhh.  ${c7}"
echo -e "${c3}       .+.o+oo:.${c1}          \`oddhhhh+   ${c7}"
echo -e "${c3}        \+.++o+o\`${c1}\`-\`\`\`\`.:ohdhhhhh+    ${c7}"
echo -e "${c3}         \`:o+++ ${c1}\`ohhhhhhhhyo++os:     ${c7}"
echo -e "${c3}           .o:${c1}\`.syhhhhhhh/${c3}.oo++o\`     ${c7}"
echo -e "${c1}               /osyyyyyyo${c3}++ooo+++/    ${c7}"
echo -e "${c1}                   \`\`\`\`\` ${c3}+oo+++o\:    ${c7}"
echo -e "${c3}                          \`oo++.      ${c20}"
echo ""

}

Linux_Mint(){

            Packages_dpkg

echo -e "${c2}                                      "
echo -e "${c2} MMMMMMMMMMMMMMMMMMMMMMMMMmds+.       "     ${c2}${user}${c7}$(hostname)
echo -e "${c2} MMm----::-://////////////oymNMd+\`    "     ${c2}OS: ${c7}$OS
echo -e "${c2} MMd      ${c7}/++                ${c2}-sNMd:   "     ${c2}Desktop: ${c7}$Desktop
echo -e "${c2} MMNso/\`  ${c7}dMM    \`.::-. .-::.\` ${c2}.hMN:  "     ${c2}Kernel: ${c7}$Kernel
echo -e "${c2} ddddMMh  ${c7}dMM   :hNMNMNhNMNMNh: ${c2}\`NMm  "     ${c2}Packages: ${c7}$Packages
echo -e "${c2}     NMm  ${c7}dMM  .NMN/-+MMM+-/NMN\` ${c2}dMM  "     ${c2}Shell: ${c7}$Shell
echo -e "${c2}     NMm  ${c7}dMM  -MMm  \`MMM   dMM. ${c2}dMM  "     ${c2}CPU: ${c7}$CPU
echo -e "${c2}     NMm  ${c7}dMM  -MMm  \`MMM   dMM. ${c2}dMM  "     ${c2}GPU: ${c7}$GPU
echo -e "${c2}     NMm  ${c7}dMM  .mmd  \`mmm   yMM. ${c2}dMM  "      ${c2}RAM: ${c7}$RAM
echo -e "${c2}     NMm  ${c7}dMM\`  ..\`   ...   ydm. ${c2}dMM  "
echo -e "${c2}     hMM- ${c7}+MMd/-------...-:sdds  ${c2}dMM  "
echo -e "${c2}     -NMm- ${c7}:hNMNNNmdddddddddy/\`  ${c2}dMM  "
echo -e "${c2}      -dMNs-${c7}\`\`-::::-------.\`\`    ${c2}dMM  "
echo -e "${c2}       \`/dMNmy+/:-------------:/yMMM  "
echo -e "${c2}          ./ydNMMMMMMMMMMMMMMMMMMMMM  "
echo -e "${c2}             \.MMMMMMMMMMMMMMMMMMM    "
echo -e "${c2}                                      ${c20}"
echo ""
}

Peppermint_Linux(){

        Packages_dpkg

echo ""
echo -e "${c1}             8ZZZZZZ${c7}MMMMM              "     ${c1}${user}${c7}$(hostname)
echo -e "${c1}          .ZZZZZZZZZ${c7}MMMMMMM.           "     ${c1}OS: ${c7}$OS
echo -e "${c7}        MM${c1}ZZZZZZZZZ${c7}MMMMMMM${c1}ZZZZ         "     ${c1}Desktop: ${c7}$Desktop
echo -e "${c7}      MMMMM${c1}ZZZZZZZZ${c7}MMMMM${c1}ZZZZZZZM       "     ${c1}Kernel: ${c7}$Kernel
echo -e "${c7}     MMMMMMM${c1}ZZZZZZZ${c7}MMMM${c1}ZZZZZZZZZ.      "     ${c1}Packages: ${c7}$Packages
echo -e "${c7}    MMMMMMMMM${c1}ZZZZZZ${c7}MMM${c1}ZZZZZZZZZZZI     "     ${c1}Shell: ${c7}$Shell
echo -e "${c7}   MMMMMMMMMMM${c1}ZZZZZZ${c7}MM${c1}ZZZZZZZZZZ${c7}MMM    "     ${c1}CPU: ${c7}$CPU
echo -e "${c1}   .ZZZ${c7}MMMMMMMMMM${c1}IZZ${c7}MM${c1}ZZZZZ${c7}MMMMMMMMM   "     ${c1}GPU: ${c7}$GPU
echo -e "${c1}   ZZZZZZZ${c7}MMMMMMMM${c1}ZZ${c7}M${c1}ZZZZ${c7}MMMMMMMMMMM   "      ${c1}RAM: ${c7}$RAM
echo -e "${c1}   ZZZZZZZZZZZZZZZZ${c7}M${c1}Z${c7}MMMMMMMMMMMMMMM   "
echo -e "${c1}   .ZZZZZZZZZZZZZ${c7}MMM${c1}Z${c7}M${c1}ZZZZZZZZZZ${c7}MMMM   "
echo -e "${c1}   .ZZZZZZZZZZZ${c7}MMM${c1}7ZZ${c7}MM${c1}ZZZZZZZZZZ7${c7}M    "
echo -e "${c1}    ZZZZZZZZZ${c7}MMMM${c1}ZZZZ${c7}MMMM${c1}ZZZZZZZZ77     "
echo -e "${c7}     MMMMMMMMMMMM${c1}ZZZZZ${c7}MMMM${c1}ZZZZZZ77      "
echo -e "${c7}      MMMMMMMMMM${c1}7ZZZZZZ${c7}MMMMM${c1}ZZZ77       "
echo -e "${c7}       .MMMMMMM${c1}ZZZZZZZZ${c7}MMMMM${c1}Z7Z7        "
echo -e "${c7}         MMMMM${c1}ZZZZZZZZZ${c7}MMMMMMM         "
echo -e "${c1}           NZZZZZZZZZZZ${c7}MMMMM           "
echo -e "${c1}              ZZZZZZZZZ${c7}MM              ${c20}"
echo ""
}

Arch_Linux(){

     Arch_Packages

echo ""
echo -e "${c6}                   -\`                 "       ${user}${c7}$(hostname)
echo -e "${c6}                  .o+\`                "       OS: ${c7}$OS
echo -e "${c6}                 \`ooo/                "       Desktop: ${c7}$Desktop
echo -e "${c6}                \`+oooo:               "       Kernel: ${c7}$Kernel
echo -e "${c6}               \`+oooooo:              "       Packages: ${c7}$Packages
echo -e "${c6}               -+oooooo+:             "        Shell: ${c7}$Shell
echo -e "${c6}             \`/:-:++oooo+:            "       CPU: ${c7}$CPU
echo -e "${c6}            \`/++++/+++++++:           "       GPU: ${c7}$GPU
echo -e "${c6}           \`/++++++++++++++:          "       RAM: ${c7}$RAM
echo -e "${c6}          \`/+++ooooooooooooo/\`        "
echo -e "${c6}         ./ooosssso++osssssso+\`       "
echo -e "${c6}        .oossssso-\`\`\`\`/ossssss+\`      "
echo -e "${c6}       -osssssso.      :ssssssso.     "
echo -e "${c6}      :osssssss/        osssso+++.    "
echo -e "${c6}     /ossssssss/        +ssssooo/-    "
echo -e "${c6}   \`/ossssso+/:-        -:/+osssso+- "
echo -e "${c6}  \`+sso+:-\`                 \`.-/+oso: "
echo -e "${c6} \`++:.                           \`-/+/ "
echo -e "${c6} .\`                                 \`/ ${c20}"
echo ""

}

if_then_elif(){

if [[ "${OS1}" == 'Arch' ]]
   then
       Arch_Linux

   elif [[ "${OS1}" == 'Ubuntu' ]]
        then
            Ubuntu_Linux

   elif [[ "${OS1}" == 'Peppermint' ]]
        then
            Peppermint_Linux

   elif [[ "${OS1}" == 'LinuxMint' ]]
        then
             Linux_Mint

   elif [[ "${OS1}" == 'Debian' ]]
        then
             Debian_Linux

   else
        warn "You are using ${OS1} but this script is not setup for ${OS1}"
        err0r "Can NOT continue! Exiting...."

fi
}


if_then_elif

# END OF SCRIPT
#


The art work is from screenfetch with slight modifications to them so they work here.
The 4 line shebang set at the top is from neofetch
The wrapper functions at the top are from a script in Black-Arch (I don't remember which script)
The script that is yours, I am sure you know well.


The other changes (as far as i can remember) are mine but you can have them, use them, modify them to your hearts content.

The purpose of expanding on your script rather than just posing my own, was because you understand the script you wrote. And you indicated in your video that you were not a programmer but you wanted to learn. Well,  the best way to learn is by expanding on what you already understand. I don't expect you to use the entire script, but hopefully some of it is useful to you. 

hope that helps

kudos

EDIT
----------------------------------------------------
I Just looked at the Ufetch script.
I guess I wasn't really expanding on anything
that you hadn't seen already.

Oh well, maybe there is something
useful in there for ya anyway.
----------------------------------------------------
Also, i edited the "if_then_else" function at the bottom,
I just cleaned it up a little and changed it to "if_then_elif"


again,
kudos
A computer without Microsoft is like a piece of chocolate cake without ketchup and mustard.
-
It is okay to not be able to answer a question,
however it should be a crime to not be able to question an answer.

@ArrowLinux
Reply
#7
Wow. Thanks everyone for the feedback. This is incredible. I will definitely check out the additions that have been made. I also made a couple more of these at https://github.com/linuxdabbler/terminfo. If anyone is interested in an Arch, Manjaro, or bullseye specific one... I did try to get font colors working in the Arch and Manjaro ones.

Thank you once again

LD
Reply
#8
(02-09-2020, 08:17 PM)eliasw4u Wrote: So i spent most of the night expanding on your script
to make it work on the systems I use. Arch, Ubuntu, Mint, And Peppermint.

I don't use Debian, but you do, and since it is your script I left it in there Wink  lol.
Actually Debian is a great distro.

Anyway here it is. It is your script, I just expanded on it,
leaving the print-out info mostly the same. I mainly did this for learning purposes.
A more detailed explanation is at the end of the post. 

I hope that this is not offensive. 

Code:
#!/usr/bin/env bash
# vim: noai:ts=4:sw=4:expandtab
# shellcheck source=/dev/null
# shellcheck disable=2009

###################################################################################
# This script uses lsb_release, lscpu, and glxinfo. make sure they are installed. #
###################################################################################
#
# START OF SCRIPT
#
#
clear ; clear

# Universal variables
user="${USER}\e[33m@"
Desktop="${XDG_CURRENT_DESKTOP}"
Kernel="$(uname -sr)"
Uptime="$(uptime -p | sed 's/up //')"
Shell="$(basename "$SHELL")"
CPU="$(lscpu | grep Model\ name | sed 's/name:\ //' | sed "s/([^)]*)/()/g" | sed 's/[)(]//g')"
GPU="$(glxinfo -B | grep Device: | sed "s/([^)]*)/()/g" | sed 's/[)(]//g')"
RAM="$(free -h | awk '/^Mem:/ {print $3 " / " $2}')"
OS1="$(lsb_release -si)"
OS="$(lsb_release -sirc)"

# colors
 c1="\e[31m" # Red
 c2="\e[32m" # Light Green
 c3="\e[33m" # Yellow
 c4="\e[34m"  # Calm Blue
 c5="\e[35m" # Violet
 c6="\e[36m" # Arch Blue
 c7="\e[37m" # White
 c8="\e[38m" # Sky Blue
 c9="\e[39m" # Light Grey
 c10="\e[30m" # Dark Grey
 c20="\e[0m" # Normal

# Package count for Debian based systems
Packages_dpkg(){
         
         Packages="$(dpkg -l | grep -c ^i)"
}

# Package count for Arch based systems
Arch_Packages(){

         Packages="$(pacman -Qs | wc -l)"

}

# An Error echo wrapper
err0r()
{

    echo >&2 "$(tput bold; tput setaf 1)[-] ERROR: ${*}$(tput sgr0)"
    echo ""
    exit 86
}

# A Warning echo wrapper
warn()
{
 echo >&2 "$(tput bold; tput setaf 3)[!] WARNING: ${*}$(tput sgr0)"
 echo ""
}

# A Message echo wrapper
msg()
{
 echo "$(tput bold; tput setaf 2)[+] ${*}$(tput sgr0)"
}


Debian_Linux(){

    Packages_dpkg

echo ""
echo -e "${c7}         _,met\$\$\$\$\$gg.          "     ${c1}${user}${c7}$(hostname)
echo -e "${c7}      ,g\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$P.       "     ${c1}OS: ${c7}$OS
echo -e "${c7}    ,g\$\$P\"\"       \"\"\"Y\$\$.\".     "     ${c1}Desktop: ${c7}$Desktop
echo -e "${c7}   ,\$\$P'              \`\$\$\$.     "     ${c1}Kernel: ${c7}$Kernel
echo -e "${c7}  ',\$\$P       ,ggs.     \`\$\$b:   "     ${c1}Packages: ${c7}$Packages
echo -e "${c7}  \`d\$\$'     ,\$P\"\'   ${c1}.${c7}    \$\$\$   "    ${c1}Shell: ${c7}$Shell
echo -e "${c7}   \$\$P      d\$\'     ${c1},${c7}    \$\$P   "    ${c1}CPU: ${c7}$CPU
echo -e "${c7}   \$\$:      \$\$.   ${c1}-${c7}    ,d\$\$'    "     ${c1}GPU: ${c7}$GPU
echo -e "${c7}   \$\$\;      Y\$b._   _,d\$P'     "      ${c1}RAM: ${c7}$RAM
echo -e "${c7}   Y\$\$.    ${c1}\`.${c7}\`\"Y\$\$\$\$P\"'         "
echo -e "${c7}   \`\$\$b      ${c1}\"-.__              "
echo -e "${c7}    \`Y\$\$                        "
echo -e "${c7}     \`Y\$\$.                      "
echo -e "${c7}       \`\$\$b.                    "
echo -e "${c7}         \`Y\$\$b.                 "
echo -e "${c7}            \`\"Y\$b._             "
echo -e "${c7}                \`\"\"\"\"           "
echo -e "${c7}                                ${c20}"
echo ""

}




Ubuntu_Linux(){

    Packages_dpkg
    
echo ""
echo -e "${c1}                          ./+o+-      ${c7}"     ${c1}${user}${c7}$(hostname)
echo -e "${c7}                  yyyyy- ${c1}-yyyyyy+     ${c7}"     ${c1}OS: ${c7}$OS
echo -e "${c7}               ${c7}://+//////${c1}-yyyyyyo     ${c7}"     ${c1}Desktop: ${c7}$Desktop
echo -e "${c3}           .++ ${c7}.:/++++++/-${c1}.+sss/\`     ${c7}"     ${c1}Kernel: ${c7}$Kernel
echo -e "${c3}         .:++o:  ${c7}/++++++++/:--:/-     ${c7}"     ${c1}Packages: ${c7}$Packages
echo -e "${c3}        o:+o+:++.${c7}\`..\`\`\`.-/oo+++++/    ${c7}"     ${c1}Shell: ${c7}$Shell
echo -e "${c3}       .:+o:+o/.${c7}          \`+sssoo+/   ${c7}"     ${c1}CPU: ${c7}$CPU
echo -e "${c7}  .++/+:${c3}+oo+o:\`${c7}             /sssooo.  ${c7}"     ${c1}GPU: ${c7}$GPU
echo -e "${c7} /+++//+:${c3}\`oo+o${c7}               /::--:.  ${c7}"      ${c1}RAM: ${c7}$RAM
echo -e "${c7} \+/+o+++${c3}\`o++o${c1}               ++////.  ${c7}"
echo -e "${c7}  .++.o+${c3}++oo+:\`${c1}             /dddhhh.  ${c7}"
echo -e "${c3}       .+.o+oo:.${c1}          \`oddhhhh+   ${c7}"
echo -e "${c3}        \+.++o+o\`${c1}\`-\`\`\`\`.:ohdhhhhh+    ${c7}"
echo -e "${c3}         \`:o+++ ${c1}\`ohhhhhhhhyo++os:     ${c7}"
echo -e "${c3}           .o:${c1}\`.syhhhhhhh/${c3}.oo++o\`     ${c7}"
echo -e "${c1}               /osyyyyyyo${c3}++ooo+++/    ${c7}"
echo -e "${c1}                   \`\`\`\`\` ${c3}+oo+++o\:    ${c7}"
echo -e "${c3}                          \`oo++.      ${c20}"
echo ""

}

Linux_Mint(){

            Packages_dpkg

echo -e "${c2}                                      "
echo -e "${c2} MMMMMMMMMMMMMMMMMMMMMMMMMmds+.       "     ${c2}${user}${c7}$(hostname)
echo -e "${c2} MMm----::-://////////////oymNMd+\`    "     ${c2}OS: ${c7}$OS
echo -e "${c2} MMd      ${c7}/++                ${c2}-sNMd:   "     ${c2}Desktop: ${c7}$Desktop
echo -e "${c2} MMNso/\`  ${c7}dMM    \`.::-. .-::.\` ${c2}.hMN:  "     ${c2}Kernel: ${c7}$Kernel
echo -e "${c2} ddddMMh  ${c7}dMM   :hNMNMNhNMNMNh: ${c2}\`NMm  "     ${c2}Packages: ${c7}$Packages
echo -e "${c2}     NMm  ${c7}dMM  .NMN/-+MMM+-/NMN\` ${c2}dMM  "     ${c2}Shell: ${c7}$Shell
echo -e "${c2}     NMm  ${c7}dMM  -MMm  \`MMM   dMM. ${c2}dMM  "     ${c2}CPU: ${c7}$CPU
echo -e "${c2}     NMm  ${c7}dMM  -MMm  \`MMM   dMM. ${c2}dMM  "     ${c2}GPU: ${c7}$GPU
echo -e "${c2}     NMm  ${c7}dMM  .mmd  \`mmm   yMM. ${c2}dMM  "      ${c2}RAM: ${c7}$RAM
echo -e "${c2}     NMm  ${c7}dMM\`  ..\`   ...   ydm. ${c2}dMM  "
echo -e "${c2}     hMM- ${c7}+MMd/-------...-:sdds  ${c2}dMM  "
echo -e "${c2}     -NMm- ${c7}:hNMNNNmdddddddddy/\`  ${c2}dMM  "
echo -e "${c2}      -dMNs-${c7}\`\`-::::-------.\`\`    ${c2}dMM  "
echo -e "${c2}       \`/dMNmy+/:-------------:/yMMM  "
echo -e "${c2}          ./ydNMMMMMMMMMMMMMMMMMMMMM  "
echo -e "${c2}             \.MMMMMMMMMMMMMMMMMMM    "
echo -e "${c2}                                      ${c20}"
echo ""
}

Peppermint_Linux(){

        Packages_dpkg

echo ""
echo -e "${c1}             8ZZZZZZ${c7}MMMMM              "     ${c1}${user}${c7}$(hostname)
echo -e "${c1}          .ZZZZZZZZZ${c7}MMMMMMM.           "     ${c1}OS: ${c7}$OS
echo -e "${c7}        MM${c1}ZZZZZZZZZ${c7}MMMMMMM${c1}ZZZZ         "     ${c1}Desktop: ${c7}$Desktop
echo -e "${c7}      MMMMM${c1}ZZZZZZZZ${c7}MMMMM${c1}ZZZZZZZM       "     ${c1}Kernel: ${c7}$Kernel
echo -e "${c7}     MMMMMMM${c1}ZZZZZZZ${c7}MMMM${c1}ZZZZZZZZZ.      "     ${c1}Packages: ${c7}$Packages
echo -e "${c7}    MMMMMMMMM${c1}ZZZZZZ${c7}MMM${c1}ZZZZZZZZZZZI     "     ${c1}Shell: ${c7}$Shell
echo -e "${c7}   MMMMMMMMMMM${c1}ZZZZZZ${c7}MM${c1}ZZZZZZZZZZ${c7}MMM    "     ${c1}CPU: ${c7}$CPU
echo -e "${c1}   .ZZZ${c7}MMMMMMMMMM${c1}IZZ${c7}MM${c1}ZZZZZ${c7}MMMMMMMMM   "     ${c1}GPU: ${c7}$GPU
echo -e "${c1}   ZZZZZZZ${c7}MMMMMMMM${c1}ZZ${c7}M${c1}ZZZZ${c7}MMMMMMMMMMM   "      ${c1}RAM: ${c7}$RAM
echo -e "${c1}   ZZZZZZZZZZZZZZZZ${c7}M${c1}Z${c7}MMMMMMMMMMMMMMM   "
echo -e "${c1}   .ZZZZZZZZZZZZZ${c7}MMM${c1}Z${c7}M${c1}ZZZZZZZZZZ${c7}MMMM   "
echo -e "${c1}   .ZZZZZZZZZZZ${c7}MMM${c1}7ZZ${c7}MM${c1}ZZZZZZZZZZ7${c7}M    "
echo -e "${c1}    ZZZZZZZZZ${c7}MMMM${c1}ZZZZ${c7}MMMM${c1}ZZZZZZZZ77     "
echo -e "${c7}     MMMMMMMMMMMM${c1}ZZZZZ${c7}MMMM${c1}ZZZZZZ77      "
echo -e "${c7}      MMMMMMMMMM${c1}7ZZZZZZ${c7}MMMMM${c1}ZZZ77       "
echo -e "${c7}       .MMMMMMM${c1}ZZZZZZZZ${c7}MMMMM${c1}Z7Z7        "
echo -e "${c7}         MMMMM${c1}ZZZZZZZZZ${c7}MMMMMMM         "
echo -e "${c1}           NZZZZZZZZZZZ${c7}MMMMM           "
echo -e "${c1}              ZZZZZZZZZ${c7}MM              ${c20}"
echo ""
}

Arch_Linux(){

     Arch_Packages

echo ""
echo -e "${c6}                   -\`                 "       ${user}${c7}$(hostname)
echo -e "${c6}                  .o+\`                "       OS: ${c7}$OS
echo -e "${c6}                 \`ooo/                "       Desktop: ${c7}$Desktop
echo -e "${c6}                \`+oooo:               "       Kernel: ${c7}$Kernel
echo -e "${c6}               \`+oooooo:              "       Packages: ${c7}$Packages
echo -e "${c6}               -+oooooo+:             "        Shell: ${c7}$Shell
echo -e "${c6}             \`/:-:++oooo+:            "       CPU: ${c7}$CPU
echo -e "${c6}            \`/++++/+++++++:           "       GPU: ${c7}$GPU
echo -e "${c6}           \`/++++++++++++++:          "       RAM: ${c7}$RAM
echo -e "${c6}          \`/+++ooooooooooooo/\`        "
echo -e "${c6}         ./ooosssso++osssssso+\`       "
echo -e "${c6}        .oossssso-\`\`\`\`/ossssss+\`      "
echo -e "${c6}       -osssssso.      :ssssssso.     "
echo -e "${c6}      :osssssss/        osssso+++.    "
echo -e "${c6}     /ossssssss/        +ssssooo/-    "
echo -e "${c6}   \`/ossssso+/:-        -:/+osssso+- "
echo -e "${c6}  \`+sso+:-\`                 \`.-/+oso: "
echo -e "${c6} \`++:.                           \`-/+/ "
echo -e "${c6} .\`                                 \`/ ${c20}"
echo ""

}

if_then_elif(){

if [[ "${OS1}" == 'Arch' ]]
   then
       Arch_Linux

   elif [[ "${OS1}" == 'Ubuntu' ]]
        then
            Ubuntu_Linux

   elif [[ "${OS1}" == 'Peppermint' ]]
        then
            Peppermint_Linux

   elif [[ "${OS1}" == 'LinuxMint' ]]
        then
             Linux_Mint

   elif [[ "${OS1}" == 'Debian' ]]
        then
             Debian_Linux

   else
        warn "You are using ${OS1} but this script is not setup for ${OS1}"
        err0r "Can NOT continue! Exiting...."

fi
}


if_then_elif

# END OF SCRIPT
#


The art work is from screenfetch with slight modifications to them so they work here.
The 4 line shebang set at the top is from neofetch
The wrapper functions at the top are from a script in Black-Arch (I don't remember which script)
The script that is yours, I am sure you know well.


The other changes (as far as i can remember) are mine but you can have them, use them, modify them to your hearts content.

The purpose of expanding on your script rather than just posing my own, was because you understand the script you wrote. And you indicated in your video that you were not a programmer but you wanted to learn. Well,  the best way to learn is by expanding on what you already understand. I don't expect you to use the entire script, but hopefully some of it is useful to you. 

hope that helps

kudos

EDIT
----------------------------------------------------
I Just looked at the Ufetch script.
I guess I wasn't really expanding on anything
that you hadn't seen already.

Oh well, maybe there is something
useful in there for ya anyway.
----------------------------------------------------
Also, i edited the "if_then_else" function at the bottom,
I just cleaned it up a little and changed it to "if_then_elif"


again,
kudos

Thank you so much. I looked through your additions.. I really like how you defined the colors and edited the  ASCII art. Using "\" to make the script skip over quotes and $.  That is much easier than the way I had originally tried in the Arch and Manjaro fetchers I wrote.  I hope you don't mind but I used your color definitions in my second attempt called bullseyeinfo.   

I also used figlet with the smslant font to customize a little further.

If I make a video covering it... I would like to thank you for your help.   But if you don't want to be named, I will just say a friendly person on the ezeelinux forum.
Reply
#9
(02-11-2020, 06:47 AM)Linuxdabbler Wrote:  
Thank you so much. I looked through your additions.. I really like how you defined the colors and edited the  ASCII art. Using "\" to make the script skip over quotes and $.  That is much easier than the way I had originally tried in the Arch and Manjaro fetchers I wrote.  I hope you don't mind but I used your color definitions in my second attempt called bullseyeinfo.   

I also used figlet with the smslant font to customize a little further.

If I make a video covering it... I would like to thank you for your help.   But if you don't want to be named, I will just say a friendly person on the ezeelinux forum.

You are welcome. This is why it is called a Linux community.

The artwork was done by the creator of screenfetch. I did make some mods to them, but not much. They get the credit for the art.
As for the rest, It is yours. And you can mention me by name, I am not bashful. I think its cool that some of my work helped you. so, ya use it however you wish. and if there is any thing else I can help with just let me know.


kudos


P.S.
 I installed Debian 10 in a VM to test this. ....... you win. lol Big Grin
A computer without Microsoft is like a piece of chocolate cake without ketchup and mustard.
-
It is okay to not be able to answer a question,
however it should be a crime to not be able to question an answer.

@ArrowLinux
Reply
#10
Please understand I am not expressing argumentative criticism.  The following examples  are friendly suggestions.


Instead of using a lengthy multiple nested if statements,  a "case"  might be more to your liking.  To me it is easier to code and read. Likewise, you should consider using meaningful names for functions instead a generic if_then_else.

Code:
OS_Choice()
{
 case "${OS1}" in

    Arch)        Arch_Linux ;;

    Ubuntu)        Ubuntu_Linux ;;

    Peppermint)    Peppermint_Linux ;;

    LinuxMint)    Linux_Mint ;;

    Debian)        Debian_Linux ;;

    *)       warn "You are using ${OS1} but this script is not setup for ${OS1}"
                err0r "Can NOT continue! Exiting...."
             ;;
 esac
}

OS_Choice


To get rid of the repetitive "-e" option in the echo statements use the "xpg_echo" bash option.

Code:
shopt -s xpg_echo    # Get rid of the annoying echo -e option.


Good luck and happy bash codingSmile
Idea  Give a man a fish, and you feed him for a day. Teach a man to fish, and you feed him for a lifetime.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)