Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
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.
Not sure where this post should go, so putting it here. We'll see where the
admins move it to. There should be a BASH subforum under software,
but don't see it.
Anyway have this script for processing emails from Thunderbird to strip off
all the email address from all mails in the system.
$(grp_srch
there's no closing bracket, and grp_srch is not a command or function.
ondoho,
Thnx, but already saw and fixed that. Now finding the "for" loops not processing at all. Added "echos" there and nothing is showing and target file is blank!
$(command) allows one to use output from a command in your script.
however, as i already pointed out, grp_srch is not a command in your script. it's just a string variable.
$(command) allows one to use output from a command in your script.
however, as i already pointed out, grp_srch is not a command in your script. it's just a string variable.
ondoho,
Since I defined/assigned the "grep" command to grp_srch on line 108, not sure what you are trying to say here.
Right now none of the processing loops (#115, #123) are working. Used the same syntax in the functions and they worked there. What am I doing wrong here?
Do I need to "RETURN" the array from the functions to have it seen? Notice the arrays to be processed are from the nested functions and I know BASH handles those with special case but not sure on the syntax for that.
you didn't remove any double quotes? or at least i don't see it in your pastebin.
try removing the double quotes on lines 118 and 126.
and lose the semicolons, you don't need them at the end of the line.
i think you're going to have to start posting more information. "Doesn't work" is not enough.
you didn't remove any double quotes? or at least i don't see it in your pastebin.
try removing the double quotes on lines 118 and 126.
and lose the semicolons, you don't need them at the end of the line.
i think you're going to have to start posting more information. "Doesn't work" is not enough.
ondoho,
If you have thunderbird installed you can run the code and you'll see it gives:
Set my "HERE" line @ line 116, because that is where I need help, lines 115-122.
line 117 is working correctly as I pipe this to an output file and get 905 lines-2 for the "Processing" echo statements, shows 903 files, which is correct. Yes that is how many email directories I have in my thunderbird. Your count may vary.
The problem lies in line 119 & 120 as though the assign to array looks right the echo on 120 is blank. Therefore when processing gets to line 143, since the array is blank, nothing happens.
If I can get the array to correctly assign, then this process will work.
Ok have the array assign working. Uncomment line #119 and pipe to output file and you will see the right arrays assigns.
Moved my "HERE" line to #141 as line #142 where the array is to be processed is still showing the array blank. I know there is a different syntax for extracting variables from nested functions in BASH and assume this is what I still have to master here.
have you tried shellcheck.net to test your script?
There are errors in it....
pan64,
Shellcheck.net is junk as if I follow what it says the whole thing quits working.
EX:
It says var-$(cmd options) is not valid, but all howtos say that is the only syntax to use when assigning a cmd line cmd to a var. The HOWTOs are right, you get nothing without the surrounding ()s!
It further says get_IMdirs () { is incorrect use get_IMdirs { but that also errors on run as the get_IMdirs () { is required. You can use get_IMdirs { but then you have to use syntax "function get_IMdirs{" which it does not say, so thus the errors.
no, shellcheck will highlight your mistakes, and you need to fix them. Keep your code clean (that means without shellcheck errors) and (re-)implement the whole logic.
This now works incidentally. And also remember, it does not work properly at this moment.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.