I was reviewing this YAD example script as a simple system utility.
But when I execute it I am getting an error with variables and other lines that I cannot pin-point.
Code: Select all
# YADtest-sysinfo.sh
/root/my-applications/bin/YADtest-sysinfo.sh: line 4: YAD_OPTIONS: command not found
/root/my-applications/bin/YADtest-sysinfo.sh: line 6: KEY: command not found
/root/my-applications/bin/YADtest-sysinfo.sh: line 32: syntax error near unexpected token `('
/root/my-applications/bin/YADtest-sysinfo.sh: line 32: `lspci -vmm | sed 's/\&/\&/g' | grep -E "^(Slot|Class|Vendor|Device|Rev):" | cut -f2 |\'
# Unable to parse command line: Cannot parse integer value “=” for --plug
The web-page I copied from is above. My copy of that is here
Code: Select all
#! /bin/bash
# -*- mode: sh -*-
YAD_OPTIONS = "--window-icon='dialog-information' --name=IxSysinfo"
KEY = $RANDOM
function show_mod_info {
TXT = " \\ n<span face='Monospace'>$(modinfo $1 | sed 's/&/\&/g;s/</\</g;s/>/\>/g' )</span>"
yad --title = $ "Module information" --button = "yad-close" --width = 500 \
--image = "application-x-addon" --text = " $ TXT "
}
export -f show_mod_info
# CPU tab
lscpu | sed -r "s/:[ ]*/ \n /" |\
yad --plug = $KEY --tabnum = 1 --image = cpu --text = $ "CPU information" \
--list - -no-selection --column = $ "Parameter" --column = $ "Value" &
# Memory tab
sed -r "s/:
22
23
, $7 , $2 , $3 , $4 , $6 }' |\
yad --plug = $KEY --tabnum = 3 --image = drive-harddisk --text = $ "Disk space usage" \
--list - -no-selection --column = $ "Device" --column = $ "Mountpoint" --column = $ "Type" \
--column = $ "Total:sz" --column = $ "Free:sz" --column = $ "Usage:bar" &
# PCI tab
lspci -vmm | sed 's/\&/\&/g' | grep -E "^(Slot|Class|Vendor|Device|Rev):" | cut -f2 |\
yad --plug = $KEY --tabnum = 4 --text = $ "PCI bus devices" \
--list --no-selection --column = $ "ID" --column = $ "Class" \
--column = $ "Vendor" --column = $ "Device" --column = $ "Rev" &
# Modules tab
awk '{printf "%s \n %s \n %s \n ", $1 , $3 , $4 }' / proc / modules | sed "s/[, --column = $ "Used" --column = $ "Depends" &
# Battery tab
( acpi -i ; acpi -a ) | sed -r "s/:[ ]*/ \n /" | yad --plug = $KEY --tabnum = 6 \
--image = battery --text = $ "Battery state" --list --no-selection \
--column = $ "Device" --column = $ "Details" &
# Sensors tab
SENSORS =( $ ( sensors | grep -E '^[^:]+$' ))
sid = 1
cid = 1
for s in ${SENSORS[@ ]} ; do
echo -e "s $sid\n <b> $s </b> \n "
sensors -A " $s " | tail -n + 2 | while read ln ; do
[[ $ln == "" ]] && continue
echo " $cid :s $sid "
echo $ln | sed -r 's/:[ ]+/ \n /'
(( cid ++))
done
(( sid ++))
done | yad - -plug = $KEY --tabnum = 7 --text = $ "Temperature sensors information" \
--list --tree --tree-expanded --no-selection --column = $ "Sensor" --column = $ "Value" &
# main dialog
TXT = $ "<b>Hardware system information</b> \\ n \\ n"
TXT += $ " \\ tOS: $(lsb_release -ds) on $ (hostname) \\ n"
TXT += $ " \\ tKernel:$(uname -sr) \\ n \\ n"
TXT += " \\ t<i>$(uptime)</i>"
yad --notebook --width = 600 --height = 450 - -title = $ "System info" --text = " $TXT " --button = "yad-close" \
--key = $KEY --tab = $ "CPU" --tab = $ "Memory" - -tab = $ "Disks" --tab = $ "PCI" --tab = $ "Modules" \
--tab = $ "Battery" --tab = $ "Sensors" --active-tab = ${1:-1}
I cant see if something copied over wrong or if command use is wrong or ??? But, I think its an error that I created somehow.
Help in what I did wrong.