TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: JOHN CARTER
date: 2020-07-19 03:34:00
subject: Strange construct in BASH

I am NOT a BASH expert by any stretch of the word, so I may have my
ignorance to blame on this.

I picked up a script for the Raspberry Pi that will, when run, give
you a report about all sortd of things about your system.  I ran this
script aftrer looking it over and it works in all areas except the
one I have included below.  This part of the script will give info
regarding the "Speed Governor" whether it is "ondemand" or otherwise.

The problem arises on the IF ststement.  The error is too many
parameters.  It looks like the "-a" is something I have never seen in
an IF statement and I can find no reference to it anywhere.

Can you more experienced BASH script writers take a look at this
etion of script and tell me where I missed the boat?

The section of script:
#===========================================================
\#!/bin/bash

# system_info.sh
LINE="---------------------------------------------------------------
-------"
## somecommands that work fine

echo "${LINE}"
echo " SPEED GOVERNOR"
GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
FORCE=$(grep "^force_turbo=" /boot/config.txt | cut -f2 -d"=")
##### the following line gives the error
if [ ${GOV} = "ondemand" -a ${FORCE} = "1" ]
then
  echo "(...but overridden by \"force_turbo=1\" found in config.txt)"
fi
echo
## remainder of script after this but not shown
#========================================================
End of script

I have not tried this on any other software but Raspberry Pi OS

Thank you for your assistance.

John Carter

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.