yggdrasil_ng/core_functions.sh

696 lines
17 KiB
Bash
Raw Permalink Normal View History

2018-05-26 21:36:16 +00:00
#-----------------------------------------------------------------------------#
# Yggdrasil NG #
# compatibility : see documentation or man pages #
# author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 #
# website : https://makotonoblog.be/ #
#-----------------------------------------------------------------------------#
2017-12-30 22:08:45 +00:00
2018-05-26 21:36:16 +00:00
#-----------------------------------------------------------------------------#
# core functions #
#-----------------------------------------------------------------------------#
2017-12-30 22:08:45 +00:00
#
# display a simple message + CR
#
function smsgn () {
printf "$*\n"
}
#
# display a simple message
#
function smsg () {
printf "$*"
}
#
# display a message + notification
#
function msg () {
printf "\n"
2018-03-22 10:45:57 +00:00
printf $JAUNE
2017-12-30 22:08:45 +00:00
if [ "$#" -gt "0" ]; then
printf "$*\n"
/usr/bin/notify-send -t 7000 "$*"
fi
2018-03-22 10:45:57 +00:00
printf $NORMAL
2017-12-30 22:08:45 +00:00
}
#
# display a message between [ ] depending of the ret_code
#
function retCode () {
typeset ret_code="$1"
if [ $ret_code == 0 ]; then
2018-03-22 10:45:57 +00:00
printf "[ "$BOLDVERT"OK"$NORMAL" ] "
2017-12-30 22:08:45 +00:00
else
2018-03-22 10:45:57 +00:00
printf "[ "$BOLDROUGE"!!"$NORMAL" ] "
2017-12-30 22:08:45 +00:00
fi
2018-02-24 16:48:53 +00:00
printf "\n"
2017-12-30 22:08:45 +00:00
}
#
# run a shell command and display a message between [ ] depending on the ret_code
#
function runCmd () {
typeset cmd="$1"
2018-03-20 03:20:15 +00:00
typeset txt="$2"
2017-12-30 22:08:45 +00:00
typeset ret_code
2018-03-20 03:22:46 +00:00
printf "[CMD] $txt "
printf "\n[CMD] $txt : $cmd\n" &>> $logFile
2017-12-30 22:08:45 +00:00
eval $cmd" &>> $logFile"
ret_code=$?
retCode $ret_code
}
#
# display a message + notification + ask to push a key to continue
#
function pressKey () {
printf "$*\n"
if which mpg123 >/dev/null; then
mpg123 -q /opt/yggdrasil/notify.mp3 &
2017-12-30 22:08:45 +00:00
fi
2018-03-22 10:45:57 +00:00
printf $INV
2017-12-30 22:08:45 +00:00
read -p "Press <Enter> key to continue ..."
2018-03-22 10:45:57 +00:00
printf $NORMAL
2017-12-30 22:08:45 +00:00
}
#
# check if OS is Mint 18
2017-12-30 22:08:45 +00:00
#
function isMint18 () {
2017-12-30 22:08:45 +00:00
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Linux Mint 18"* ]]; then
2017-12-30 22:08:45 +00:00
return 0
else
return 1
fi
}
#
# check if OS is Ubuntu 16.04
#
function isUbuntu1604 () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Ubuntu 16.04"* ]]; then
return 0
else
return 1
fi
}
#
# check if OS is Mint 19
#
2018-06-05 06:52:09 +00:00
function isMint19 () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Linux Mint 19"* ]]; then
return 0
else
return 1
fi
}
#
# check if OS is Ubuntu 18.04
#
function isUbuntu1804 () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Ubuntu 18.04"* ]]; then
return 0
else
return 1
fi
}
#
# check if OS is Mint 20
#
function isMint20 () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Linux Mint 20"* ]]; then
return 0
else
return 1
fi
}
#
# check if OS is Ubuntu 20.04
#
function isUbuntu2004 () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Ubuntu 20.04"* ]]; then
return 0
else
return 1
fi
}
2017-12-30 22:08:45 +00:00
#
# check if DE is Mate
#
function isMate () {
if [[ $DESKTOP_SESSION == *"mate"* ]]; then
return 0
else
return 1
fi
}
#
# heck if DE is Cinnamon
#
function isCinnamon () {
if [[ $DESKTOP_SESSION == *"cinnamon"* ]]; then
return 0
else
return 1
fi
}
2018-03-14 18:34:00 +00:00
#
# check and install required dependencies for Yggdrasil
#
function yggInit () {
msg "Performing some Initializing steps"
2018-03-16 19:34:10 +00:00
runCmd "echo sience-config science-config/group select '$myHomedir ($myHomedir)' | sudo debconf-set-selections" \
"apply settings for science-config pkg"
2018-03-30 07:39:12 +00:00
if ! dpkg --print-foreign-architectures | grep -qi i386; then
runCmd "sudo dpkg --add-architecture i386" \
"adding i386 architecture"
else
printf "i386 architecture already added [ "$BOLDVERT"OK"$NORMAL" ] \n"
2018-03-14 18:34:00 +00:00
fi
installAppsFromList init
2018-03-14 18:34:00 +00:00
}
2017-12-30 22:08:45 +00:00
#
# system update
2018-04-28 20:53:10 +00:00
#TODO: add pip, npm (yarn?), gem
2017-12-30 22:08:45 +00:00
#
function updateSystem () {
typeset ret_code
printf "[APT] update "
printf "\n[APT] update\n" &>> $logFile
sudo apt-get update &>> $logFile
ret_code=$?
retCode $ret_code
printf "[APT] upgrade "
printf "\n[APT] upgrade\n" &>> $logFile
sudo apt-get -y upgrade &>> $logFile
ret_code=$?
retCode $ret_code
printf "[APT] dist-upgrade "
printf "\n[APT] dist-upgrade\n" &>> $logFile
sudo apt-get -y dist-upgrade &>> $logFile
ret_code=$?
retCode $ret_code
2018-03-14 18:34:00 +00:00
if which snap >/dev/null; then
printf "[SNAP] refresh "
printf "\n[SNAP] refresh\n" &>> $logFile
sudo snap refresh &>> $logFile
2018-03-14 11:10:56 +00:00
ret_code=$?
2018-03-14 18:34:00 +00:00
retCode $ret_code
2018-03-14 11:10:56 +00:00
fi
2018-01-01 15:58:02 +00:00
if which flatpak >/dev/null; then
printf "[FLATPAK] update "
printf "\n[FLATPAK] update\n" &>> $logFile
sudo flatpak update -y &>> $logFile
ret_code=$?
retCode $ret_code
fi
2018-01-01 15:58:02 +00:00
repoAdded=0
2017-12-30 22:08:45 +00:00
}
#
# add ppa
# input : ppa name
#
function addPPA () {
typeset ret_code
2018-05-03 23:40:19 +00:00
prefix="ppa:"
str="$*"
str2search=${str#$prefix}
if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -q ${str2search}; then
printf "[PPA] adding : $* "
printf "\n[PPA] adding $*\n" &>> $logFile
if isUbuntu2004; then
sudo add-apt-repository -yn $* &>> $logFile
else
sudo add-apt-repository -y $* &>> $logFile
fi
ret_code=$?
retCode $ret_code
else
2018-03-22 10:45:57 +00:00
printf "[PPA] PPA already added [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi
2017-12-30 22:08:45 +00:00
}
#
# add repo's key
# input : file's url OR keyserver + key
#
function addKey () {
typeset ret_code
case $# in
"1")
printf "[REPO] adding key from file : $1 "
printf "\n[REPO] adding key from file $1\n" &>> $logFile
wget -qO - $1 | sudo apt-key add - &>> $logFile
ret_code=$?
retCode $ret_code
;;
"2")
printf "[REPO] adding key $2 from $1 "
printf "\n[REPO] adding key $2 from $1\n" &>> $logFile
gpg --keyserver $1 --recv-keys $2 &>> $logFile \
2018-03-16 03:57:06 +00:00
&& gpg -a --export $2 | sudo apt-key add - &>> $logFile
2017-12-30 22:08:45 +00:00
ret_code=$?
retCode $ret_code
;;
esac
}
#
# create new entry in /etc/apt/source.list.d/
# input : filename, repo, src repo
#
function addRepo () {
typeset ret_code
2018-06-04 11:44:23 +00:00
if [ ! -f /etc/apt/sources.list.d/$1 ]; then
printf "[REPO] adding : $2 in $1 "
printf "\n[REPO] adding $2 in $1\n" &>> $logFile
echo $2 | sudo tee /etc/apt/sources.list.d/$1 &>> $logFile
2017-12-30 22:08:45 +00:00
ret_code=$?
retCode $ret_code
2018-06-04 11:44:23 +00:00
if [ "$#" -eq 3 ]; then
printf "[REPO] adding : $3 in $1 "
printf "\n[REPO] adding $3 in $1\n" &>> $logFile
echo $3 | sudo tee -a /etc/apt/sources.list.d/$1 &>> $logFile
ret_code=$?
retCode $ret_code
fi
else
2018-06-04 18:57:43 +00:00
printf "[REPO] already added [ "$BOLDVERT"OK"$NORMAL" ] \n"
2017-12-30 22:08:45 +00:00
fi
}
#
# install package manually
2018-05-03 23:15:38 +00:00
# input : url of package, package name, menu mode
2017-12-30 22:08:45 +00:00
#
function installPackageDpkg () {
2018-03-14 18:44:29 +00:00
printf "[PKG] Installing $2 from $1 "
printf "\n[PKG] installing $2 from $1\n" &>> $logFile
cd /tmp \
2018-03-30 07:39:12 +00:00
&& wget -q -O $2 $1 &>> $logFile \
2020-07-04 19:02:53 +00:00
&& sudo apt-get install -fy /tmp/$2 &>> $logFile
2018-03-14 18:44:29 +00:00
ret_code=$?
retCode $ret_code
2018-05-03 23:15:38 +00:00
if [ "$3" == "yes" ]; then
pressKey
fi
2017-12-30 22:08:45 +00:00
}
#
# install package from repositories
# input : package manager, package name
# package manager available : apt, pip, npm, gem, snap
2018-07-09 07:09:36 +00:00
# TODO: add apm, code, flatpak, umake?, use yarn instead of npm ?
2017-12-30 22:08:45 +00:00
#
function installPackage () {
typeset pkg="$2"
2017-12-30 22:08:45 +00:00
typeset ret_code
case $1 in
"apt")
2018-02-13 09:58:11 +00:00
printf "[APT] Installing $pkg "
printf "\n[APT] installing $pkg\n" &>> $logFile
2018-01-03 22:20:50 +00:00
sudo apt-get install -fy $pkg &>> $logFile
2017-12-30 22:08:45 +00:00
ret_code=$?
retCode $ret_code
;;
"pip")
if which pip3 >/dev/null; then
2018-02-13 09:58:11 +00:00
printf "[PIP] Installing $pkg "
printf "\n[PIP] installing $pkg\n" &>> $logFile
2018-01-03 22:20:50 +00:00
sudo -H pip3 install --upgrade $pkg &>> $logFile
2017-12-30 22:08:45 +00:00
ret_code=$?
retCode $ret_code
fi
;;
"npm")
if which npm >/dev/null; then
2018-02-13 09:58:11 +00:00
printf "[NPM] Installing $pkg "
printf "\n[NPM] installing $pkg\n" &>> $logFile
npm install -g $pkg &>> $logFile
2017-12-30 22:08:45 +00:00
ret_code=$?
retCode $ret_code
fi
;;
"gem")
if which gem >/dev/null; then
2018-02-13 09:58:11 +00:00
printf "[GEM] Installing $pkg "
printf "\n[GEM] installing $pkg\n" &>> $logFile
2018-01-03 22:20:50 +00:00
sudo gem install $pkg &>> $logFile
2017-12-30 22:08:45 +00:00
ret_code=$?
retCode $ret_code
fi
;;
"snap")
if which snap >/dev/null; then
2018-02-13 09:58:11 +00:00
printf "[SNAP] Installing $pkg "
printf "\n[SNAP] installing $pkg\n" &>> $logFile
sudo snap install $pkg --classic &>> $logFile
2017-12-30 22:08:45 +00:00
ret_code=$?
retCode $ret_code
fi
;;
"flatpak")
if which flatpak >/dev/null; then
printf "[FLATPAK] Installing $pkg "
printf "\n[FLATPAK] installing $pkg\n" &>> $logFile
sudo flatpak install -y $pkg &>> $logFile
ret_code=$?
retCode $ret_code
fi
;;
2017-12-30 22:08:45 +00:00
esac
}
#
# check dependency and install it if necessary
2018-03-14 18:50:07 +00:00
# input : package manager, package name, cmd/bin to check
2018-03-14 18:53:53 +00:00
#
2017-12-30 22:08:45 +00:00
function checkAndInstallDep () {
2018-03-14 18:50:07 +00:00
if ! which $3 >/dev/null; then
2018-03-22 10:45:57 +00:00
printf "[DEP] dependency $2 not found [ "$BOLDROUGE"!!"$NORMAL" ]\n"
2018-03-14 18:50:07 +00:00
printf "[DEP] dependency $2 not found\n" &>> $logFile
2017-12-30 22:08:45 +00:00
case $1 in
"apt")
installPackage apt $2
;;
"npm")
installPackage npm $2
;;
"pip")
installPackage pip $2
;;
"gem")
installPackage gem $2
;;
"snap")
installPackage snap $2
;;
"flatpak")
installPackage flatpak $2
;;
2017-12-30 22:08:45 +00:00
esac
fi
}
#
# add specific repository for a given package
# input : unique ID, apt cache update yes/no
#
function addSpecificRepoFct () {
for i in $AppsRepo; do
appRepo=(${i//;/ })
if [ "${appRepo[0]}" == "$1" ]; then
2018-06-04 19:18:08 +00:00
printf "[ADD_REPO_PPA][$1][${appRepo[1]}]...\n"
2017-12-30 22:08:45 +00:00
eval "${appRepo[1]}"
2018-01-01 15:58:02 +00:00
repoAdded=$(($repoAdded+1))
2017-12-30 22:08:45 +00:00
fi
done
if [ "$2" == "yes" ]; then
updateSystem
fi
2018-02-24 21:12:20 +00:00
unset i
unset appRepo
2017-12-30 22:08:45 +00:00
}
#
# find and execute Pre/Post install functions for a specific app
# input : unique ID, pre/post
2017-12-30 22:08:45 +00:00
#
function processAppTrtFct () {
2018-06-04 11:53:20 +00:00
typeset i
if [ "$2" == "post" ]; then
for i in $AppsPostTrtFct; do
appPostTrtFct=(${i//;/ })
if [ "${appPostTrtFct[0]}" == "$1" ]; then
2018-05-30 07:09:12 +00:00
printf "[TRT][POST][$1][${appPostTrtFct[1]}]"
eval "${appPostTrtFct[1]}"
fi
done
else
for i in $AppsPreTrtFct; do
appPreTrtFct=(${i//;/ })
if [ "${appPreTrtFct[0]}" == "$1" ]; then
2018-05-30 07:09:12 +00:00
printf "[TRT][PRE][$1][${appPreTrtFct[1]}]"
eval "${appPreTrtFct[1]}"
fi
done
fi
2018-06-04 11:53:20 +00:00
unset i
2017-12-30 22:08:45 +00:00
}
#
# install all about a specific category from Apps array app list (headless)
# input : category name
#
function installAppsFromList () {
msg "Installing apps from $1 category"
for i in $Apps; do
app=(${i//;/ })
if [ "${app[2]}" == "$1" ]; then
addSpecificRepoFct ${app[3]}
fi
done
unset i
unset app
2018-01-01 15:58:02 +00:00
if [ "$repoAdded" -gt "0" ]; then
updateSystem
fi
2017-12-30 22:08:45 +00:00
for i in $Apps; do
app=(${i//;/ })
if [ "${app[2]}" == "$1" ]; then
2018-06-04 11:46:26 +00:00
processAppTrtFct ${app[3]} "pre"
2017-12-30 22:08:45 +00:00
installPackage ${app[1]} ${app[0]}
2018-06-04 11:46:26 +00:00
processAppTrtFct ${app[3]} "post"
2017-12-30 22:08:45 +00:00
fi
done
}
#
# generate install apps menu about a specific category from Apps array app list (Menu)
# input : category name
#
function installAppsFromListMenu () {
for i in $Apps; do
app=(${i//;/ })
if [ "${app[2]}" == "$1" ]; then
list+=("${app[3]}" "${app[3]}" "ON")
fi
done
pkg=$(whiptail \
--title "Yggdrasil $version - App Install ($1)" \
--checklist \
"Select app to install and press OK" 25 80 19 \
"${list[@]}" 3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
for pkgToInstall in $pkg; do
for i in $Apps; do
app=(${i//;/ })
if [ "${app[3]}" == "${pkgToInstall//\"}" ]; then
addSpecificRepoFct ${app[3]}
fi
done
done
unset i
unset app
unset pkgToInstall
if [ "$repoAdded" -gt "0" ]; then
updateSystem
fi
2017-12-30 22:08:45 +00:00
for pkgToInstall in $pkg; do
for i in $Apps; do
app=(${i//;/ })
if [ "${app[3]}" == "${pkgToInstall//\"}" ]; then
2018-06-04 11:46:26 +00:00
processAppTrtFct ${app[3]} "pre"
2017-12-30 22:08:45 +00:00
installPackage ${app[1]} ${app[0]}
2018-06-04 11:46:26 +00:00
processAppTrtFct ${app[3]} "post"
2017-12-30 22:08:45 +00:00
fi
done
done
fi
unset list
pressKey
}
#
# create app shortcut
# inputs : bin to exec, icon path, category, name, local/global, start w/ session
#
function createAppShortcut () {
typeset ret_code
shortcut='[Desktop Entry]\n'
shortcut+='Encoding=UTF-8\n'
shortcut+='Terminal=0\n'
shortcut+='Exec='$1'\n'
shortcut+='Icon='$2'\n'
shortcut+='Type=Application\n'
if [ "$6" == "start" ]; then
shortcut+='X-MATE-Autostart-enabled=true\n\n'
else
shortcut+='Categories='$3';\n'
fi
shortcut+='StartupNotify=true\n'
shortcut+='Name='$4'\n'
shortcut+='GenericName='$4'\n'
shortcut+='Comment='
if [ "$5" == "global" ]; then
smsg "creating shortcut for $4 "
echo -e $shortcut > /usr/share/applications/"$4".desktop
ret_code=$?
retCode $ret_code
else
mkdir -p /home/$myHomedir/.local/share/applications
smsg "creating shortcut for $4 "
echo -e $shortcut > /home/"$myHomedir"/.local/share/applications/"$4".desktop
ret_code=$?
retCode $ret_code
fi
}
#
# show Yggdrasil logo
#
function dispLogo () {
printf "\n"
2018-03-22 10:45:57 +00:00
printf $BOLDJAUNE
2017-12-30 22:08:45 +00:00
printf "██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ █████╗ ███████╗██╗██╗ \n"
printf "╚██╗ ██╔╝██╔════╝ ██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██╔════╝██║██║ \n"
printf " ╚████╔╝ ██║ ███╗██║ ███╗██║ ██║██████╔╝███████║███████╗██║██║ \n"
printf " ╚██╔╝ ██║ ██║██║ ██║██║ ██║██╔══██╗██╔══██║╚════██║██║██║ \n"
printf " ██║ ╚██████╔╝╚██████╔╝██████╔╝██║ ██║██║ ██║███████║██║███████╗\n"
printf " ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝\n"
printf "$BOLDROUGE Customize Linux Mint & Ubuntu made easier\n"
2017-12-30 22:08:45 +00:00
printf "$BOLDBLANC ver "$version" - GPLv3 - Francois B. (Makotosan) - makotonoblog.be\n"
printf $NORMAL
2017-12-30 22:08:45 +00:00
printf "\n"
}
#
# show usage for headless mode
#
function usage () {
dispSysInfos
printf "\n"
2018-03-22 10:45:57 +00:00
printf $NORMAL
2018-03-22 20:02:53 +00:00
printf "Usage : yggdrasil [options]\n\n"
2018-05-13 03:50:34 +00:00
printf " "$BOLDVERT"-f"$NORMAL" : install everything (see man pages for more details)(a+c+d+q)\n"
printf " "$BOLDVERT"-a"$NORMAL" : install all apps\n"
2018-03-30 07:39:12 +00:00
printf " "$BOLDVERT"-c"$NORMAL" : install Themes and Icons\n"
printf " "$BOLDVERT"-w"$NORMAL" : install Nitrogen + remove desktop management from caja\n"
printf " "$BOLDVERT"-d"$NORMAL" : install DNS Cache Unbound\n"
2018-03-30 07:39:12 +00:00
printf " "$BOLDVERT"-q"$NORMAL" : install cardreader apps\n"
printf " "$BOLDVERT"-s"$NORMAL" : install Solaar for Logitech Unifying devices\n"
printf " "$BOLDVERT"-t"$NORMAL" : install TLP for Laptops and low energy usage\n"
2019-07-10 20:50:00 +00:00
printf " "$BOLDVERT"-k"$NORMAL" : install HWE (Ubuntu's Hardware Enablement Stack)(newer kernel+xorg)\n"
printf " "$BOLDVERT"-g"$NORMAL" : install/unlock SNAP + Store (not recommanded ;-))\n"
2020-07-04 17:48:42 +00:00
printf " "$BOLDVERT"-j"$NORMAL" : install/enable unattended-upgrades (security auto update))\n"
2018-03-22 20:02:53 +00:00
printf " "$BOLDVERT"-u"$NORMAL" : update system (apt,snap,...)\n"
2018-03-30 07:39:12 +00:00
printf " "$BOLDVERT"-p"$NORMAL" : clean useless packages\n"
2020-07-04 17:56:41 +00:00
printf " "$BOLDVERT"-v"$NORMAL" : show version number\n"
2018-03-22 20:02:53 +00:00
printf " "$BOLDVERT"-h"$NORMAL" : show help & informations\n"
printf "\n"
}
function dispSysInfos () {
# CPU Architecture
2018-03-22 10:45:57 +00:00
printf $BOLDVERT"Architecture : "$NORMAL
uname -m
# Current user homedir
2018-03-22 10:45:57 +00:00
printf $BOLDVERT"User (userdir) :"$NORMAL" $myHomedir\n"
# Linux Distro Name
2018-03-22 10:45:57 +00:00
printf $BOLDVERT"OS : "$NORMAL
lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'
# Kernel version
2018-03-22 10:45:57 +00:00
printf $BOLDVERT"Kernel : "$NORMAL
uname -r
# Desktop Name
2018-03-22 10:45:57 +00:00
printf $BOLDVERT"Desktop : "$NORMAL
case $XDG_CURRENT_DESKTOP in
"ENLIGHTENMENT")
printf "Enlightenment"
printf "\n"
;;
"GNOME")
printf "Gnome"
printf "\n"
;;
"KDE")
printf "KDE"
printf "\n"
;;
"LXDE")
printf "LXDE"
printf "\n"
;;
"MATE")
printf "Mate"
printf "\n"
;;
"XFCE")
printf "XFCE"
printf "\n"
;;
"X-Cinnamon")
printf "Cinnamon"
printf "\n"
;;
"Unity")
printf "Unity"
printf "\n"
;;
esac
# Screen Resolution
printf $BOLDVERT"Screen resolution : "$NORMAL
xdpyinfo | sed -n 's/.*dim.* \([0-9]*x[0-9]*\) .*/\1/pg' | tr '\n' ' '
printf "\n"
# Type of Shell
2018-03-22 10:45:57 +00:00
printf $BOLDVERT"Shell : "$NORMAL
shellType=$(ps -p $PPID -o cmd --no-heading)
shellType=${shellType/-}
shellType=${shellType//*\/}
printf $shellType"\n"
2018-05-09 08:34:26 +00:00
}