[solved] mint-fortune in Mint 12

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
gammelsmurf1

[solved] mint-fortune in Mint 12

Post by gammelsmurf1 »

The thing is I couldn't see the nit-wit fortunes when I opened a terminal.
After a little search on How-To, I changed a bit in mint-fortune bash script

Code: Select all

sudo gedit /usr/bin/mint-fortune
And commented out the control function, whether you wished the fortunes or not.

Code: Select all

if [ -x "/usr/bin/gconftool-2" ]; then
    #showfortunes=`gconftool-2 --get /desktop/linuxmint/terminal/show_fortunes 2>/dev/null`
    #if [ "$showfortunes" == "true" ]; then        
        show_fortune
    #fi
fi
And now i've got 'Husse' giving me some nice fortune cookies when I open Terminal. :)

Now the question: How to make this work like it supposed to, i.e in Gconf/mintDesktop configuration?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Oscar799
Level 20
Level 20
Posts: 10403
Joined: Tue Aug 11, 2009 9:21 am
Location: United Kingdom

Re: mint-fortune in Mint 12

Post by Oscar799 »

I did it with gconf editor
desktop>linuxmint>terminal make sure the box to the right of "show_fortunes",directly under "value" is checked
Image
gammelsmurf1

Re: mint-fortune in Mint 12

Post by gammelsmurf1 »

So it would seem, but now I can't revert.
And it looks like it's 'mateconf' editor and not gconf editor that's installed.
User avatar
Oscar799
Level 20
Level 20
Posts: 10403
Joined: Tue Aug 11, 2009 9:21 am
Location: United Kingdom

Re: mint-fortune in Mint 12

Post by Oscar799 »

Looks like you need to get a check mark into that box under "Varde"
Image
gammelsmurf1

Re: mint-fortune in Mint 12

Post by gammelsmurf1 »

Oscar799 wrote:Looks like you need to get a check mark into that box under "Varde"
Ooh, i've got it to work when changed in the mint-fortune bash script.
So...
Fortunes is showin up despite both gconf and mateconf gives me false value

Code: Select all

/ "That is the magic sudo command. So put \
| sudo in front of the command and it'll  |
| work."                                  |
|                                         |
\ Husse Jul 20 2007                       /
 -----------------------------------------
  \
   \   \_\_    _/_/
    \      \__/
           (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||
~ $ mateconftool-2 -g /desktop/linuxmint/terminal/show_fortunes
false

~ $ gconftool-2 -g /desktop/linuxmint/terminal/show_fortunes
false
User avatar
Oscar799
Level 20
Level 20
Posts: 10403
Joined: Tue Aug 11, 2009 9:21 am
Location: United Kingdom

Re: mint-fortune in Mint 12

Post by Oscar799 »

Someone mentioned this on another thread

Menu>Other>DesktopSettings>Terminal there is a checkbox for "Show Fortunes" there....
Image
gammelsmurf1

Re: mint-fortune in Mint 12

Post by gammelsmurf1 »

Well, thx for all your effort but I managed to fix it in a different way. The issue here was that a simple blank and a couple of " " was making the default script for mint-fortune non-aware if the checkbox was ticked or not. So if anyone has the same issue, I make my version available here:

Code: Select all

#!/bin/bash

function show_fortune {
    RANGE=4
    number=$RANDOM
    let "number %= $RANGE"
    case $number in
        0)
            cow="moose"
            ;;
        1)
            cow="tux"
            ;;
        2)
            cow="koala"
            ;;	
	3)
	    cow="bunny"
	    ;;	
    esac

    RANGE=2
    number=$RANDOM
    let "number %= $RANGE"
    case $number in
        0)
            command="/usr/games/cowsay"
            ;;
        1)
            command="/usr/games/cowthink"
            ;;
    esac
    /usr/games/fortune | $command -f $cow
}

if [ -x "/usr/bin/mateconftool-2" ]; then

    SHOWFORTUNES=$(mateconftool-2 --get /desktop/linuxmint/terminal/show_fortunes) 2> /dev/null
#echo "$SHOWFORTUNES"

    if [ $SHOWFORTUNES == "true" ]; then
	show_fortune
	#else
	#fortune
    fi
fi
And be aware that the checkbox in Menu>Other>DesktopSettings>Terminal change the value in `mateconftool-2` and not `gconftool-2`, at least in my system.

It took some time, trial and error, but in the end I know a lot more about BASH and scripting, so that's a good thing.

I change this as solved...
Locked

Return to “Scripts & Bash”