SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I want my system to email me when there is an update available via slackpkg. I decided to try a bash script to do the notification. So I started down this route:
VAR = $(slackpkg check-updates)
VAR1 = "No news is good news "
if [ "$VAR" = "$VAR1" ] then; . . .
I keep getting an error on the string comparison. I am guessing the variable types are different but I can't figure out how to fix it. Does anyone know how I can fix this script or accomplish the task at hand.
Make sure you have the syntax correct. The ';' goes before the then, and the variables don't get a space before or after the equal sign in their assignment. A space does go between the variables and the equal sign in the [ command.
VAR="No news is good news "
VAR1="No news is good news "
if [ "$VAR" = "$VAR1" ] ; then
Wasn't sure if your code has the typos or your post does.
I'm pretty sure the syntax I used was correct but I just typed carelessly in the message above. It looked like a "data type" error because I outputted the VAR and VAR1 and they looked to both be exactly the same. I check for '/n' and other escape characters and there weren't any. When I ran it there was an error and it also returned "false" when it should have been "true."
When I call the VAR=$(slackpkg check-updates) that should return a standard string right?