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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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?