Все:
Добрый вечер!
Я использую Ubuntu 18.04 LTS
с bash 4.4.20
.
Вот мой скрипт:
results=`echo "SELECT cacheuid,status,expire from imagecache where rawline = '$line';" | mysql -u$mysql_user -p$mysql_pass -D$mysql_db -h$mysql_host -s 2> /dev/null`
if [ -z "$results" ]
then # The cache look up failed.
echo "\$results is empty"
else # The cache look up succeeded.
echo "\$results is NOT empty. It is = $results"
cacheuid=$(echo "$results" | cut -d " " -f 1)
stat=$(echo "$results" | cut -d " " -f 2)
expire=$(echo "$results" | cut -d " " -f 3)
fi
echo "Query Results : '$results'"
echo "CacheUID : $cacheuid"
echo "Status : $stat"
echo "Expire Time : $expire"
И вот результаты:
$results is NOT empty. It is = 1 waiting 1588636095
Query Results : '1 waiting 1588636095'
CacheUID : 1 waiting 1588636095
Status : 1 waiting 1588636095
Expire Time : 1 waiting 1588636095
Я ожидаю таких результатов:
$results is NOT empty. It is = 1 waiting 1588636095
Query Results : '1 waiting 1588636095'
CacheUID : 1
Status : waiting
Expire Time : 1588636095
Где я ошибаюсь в разрезах?
Спасибо!