Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Hi grail! Indeed this is the simpliest solution, but it should preceded by a command which adds double quotes around the RHS, due to the presence of spaces. For example (using eval as alternative to the source command):
Thanks for your ideas so far. I have to experiment with them. I'm not new to scripting in general, but I am new to Linux scripting, so I don't know which commands to use to best get the job done.
My end game here is to monitor whether a Windows server is up and running by having it send a text file periodically via FTP to my Linux system. The Linux script will read the timestamp from the text file and compare it to it's current timestamp to see how much time has passed. If more than say 15 minutes has passed since the timestamp has been updated by the remote server, then I want to use the variables from the text file and send an email to the recipient letting them know that their server may be down.
So I want to read the text file and make each line into a Linux variable and then compare the current time stamp against the one in the text file variable (I don't know yet if I can directly compare a Windows time stamp with a Linux one) and then send out an email if needed.
Well I guess my question back would be ... how is the file being generated?
ie. If you could place single or even double quotes around everything on the RHS then sourcing the file, ie the dot in my simple solution,
will turn all items on the LHS into variables that could be used in a script.
Or you could read the file through a loop maybe using something like awk to maybe split on the equals and provide the 2 halves that could be tested
and then used accordingly.
I tried out the above command from the command line and the result was that it listed each line of the text file and at the end of the last line it said "command not found". I could not echo the variables out.
I'd like the command to set each line as shell variable so I can use them. Not sure why the command not found. I'm using CentOS 5.5 BTW.
Grail - I'm going to generate the file using a vbscript on the Windows server and then FTP it to the Linux server. I can put anything I need to in that file, so if quotes would help, that shouldn't be a problem.
I tried the suggestion of putting the quotes around the RHS info and it works beautifully. I can't believe how easy that was. Thank you
Now I just have to figure out how to compare the Windows timestamp against the current linux timestamp. If you have any suggestions there I would appreciate it. Again, I have complete flexibility in how I generate the timestamp variable on the Windows side.