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!
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I like fortune, and it's fun having them come up when I open a terminal window, but yesterday I was given a fortune (under wisdom of all things) from the turd Arthur Balfour. I WILL NOT have that a$$hat in my fortunes.
Reading the man page, I saw that there is an -i option for ignore, which appears to be used with the -m option (pattern). I've tried a few things, but I'm really not sure how to use this two options together. I've tried:
Which mostly just gives the listing of fortunes that match the pattern. So how do I ignore a pattern, and is there some way to confirm that a pattern has been put on ignore?
I think you'll have to edit the file(s) to remove the quotes that you don't want to see.
Simple enough to do. Using the wisdom file as an example:
Quote:
...
%
Nothing is so firmly believed as that which we least know.
-- Michel de Montaigne
%
Nothing matters very much, and few things matter at all.
-- Arthur Balfour
%
Of all men's miseries, the bitterest is this:
to know so much and have control over nothing.
-- Herodotus
%
...
Edit /usr/share/games/fortunes/wisdom to remove the Balfour quote.
Then run "strfile wisdom" to create the .dat file (see man strfile)
I think you'll have to edit the file(s) to remove the quotes that you don't want to see.
Simple enough to do. Using the wisdom file as an example:
Edit /usr/share/games/fortunes/wisdom to remove the Balfour quote.
Then run "strfile wisdom" to create the .dat file (see man strfile)
Awesome - that's perfect! I'd thought about just editing the wisdom file, but then there was that .dat file there... which I assume is the one actually used by fortune. I'll have to learn about 'strfile'.... didn't realize re-creating that file would be that easy! Thank you norobro!
Edit: Just so that you know - it worked perfectly! Thank you very much!
Last edited by RobertLM78; 04-27-2017 at 05:31 PM.
I think what you want is either not possible with fortune, or you have to come up with some regex that says "NOT Balfour":
Quote:
Originally Posted by man fortune
-m pattern
Print out all fortunes which match the basic regular expression pattern. The syntax
of these expressions depends on how your system defines re_comp(3) or regcomp(3),
but it should nevertheless be similar to the syntax used in grep(1).
also i'm worried about "all" in the first sentence...?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.