# Query the database for Name, Serial Number, Email Contact and Days Offline
HEDS=({$(mysql gn_config --user=myname --password=mypass-s -e "SELECT hed_location, hed_name, hed_email, DATEDIFF(NOW(),xcd_last_seen) AS last_update FROM config.cfg_hs, repository.xml_data WHERE hed_key=xcd_hed_key ORDER BY last_update DESC")})
# The total number of Headends is total number records divided by number of fields
let "tot=${#HEDS[@]}/4"
echo $tot
# Loop through each account record
for (( i=0 ; i<tot ; i++ )); do
# The field ids to work with
let "val1=$i*4"
let "val2=val1+1"
let "val3=val2+1"
let "val4=val3+1"
# Extract the values from the array
SERIAL=${HEDS[$val1]##*/}
NAME=${HEDS[$val2]}
EMAIL=${HEDS[$val3]}
DAYS=${HEDS[$val4]}
ASKER
ASKER
'"' || hed_name || '"'
and this returned "||" instead of the actual field '"' hed_name '"'
and this returned "hed_name" instead of the actual field although my field count formula works now' hed_name '
and this returned "hed_name" instead of the actual field although my field count formula works nowASKER
Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.
TRUSTED BY
Open in new window
This would select field hed_name surrounded with double quotes. Don't know if this would work in mysql.