Received: from list by lists.gnu.org with archive (Exim 4.71) id 1SPbpi-000364-8F for mharc-grub-devel@gnu.org; Wed, 02 May 2012 11:51:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPbpW-0002Uk-4L for grub-devel@gnu.org; Wed, 02 May 2012 11:51:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPbpP-000257-MN for grub-devel@gnu.org; Wed, 02 May 2012 11:51:01 -0400 Received: from smtprelay02.ispgateway.de ([80.67.31.40]:43538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPbpP-00024o-Ct for grub-devel@gnu.org; Wed, 02 May 2012 11:50:55 -0400 Received: from [88.67.16.117] (helo=[192.168.1.11]) by smtprelay02.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1SPbpM-0006dg-IU for grub-devel@gnu.org; Wed, 02 May 2012 17:50:53 +0200 Message-ID: <4FA157DC.8070603@jomammele.de> Date: Wed, 02 May 2012 17:50:52 +0200 From: Joachim Mammele User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: assigning a value to a variable in 00_header References: <4FA132D0.20703@jomammele.de> In-Reply-To: <4FA132D0.20703@jomammele.de> Content-Type: multipart/alternative; boundary="------------070706040304040905090804" X-Df-Sender: bWFpbEBqb21hbW1lbGUuZGU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.67.31.40 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 May 2012 15:51:12 -0000 This is a multi-part message in MIME format. --------------070706040304040905090804 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sorry, the source code examples I've sent are from grub.cfg and not from 00_header - in 00_header a $ needs to be escaped with \ Greetings Joachim Am 02.05.2012 15:12, schrieb Joachim Mammele: > Hi everybody, > > I'd like to add a value to a user variable in 00_header but I get the > error "not an assignment". > but if I echo directly the value everything works fine. > > What can I do? How can I use a variable my_variable? Is there another > way to check for different values of \$? ? > > Any help would be appreciated. > > Greetings > Joachim > > > this is what is working fine: > > checkfrontkeys > echo "pressed key: \$?" > > > ------------- > > this is what I'm struggling with (I've also been trying to use "case > \$? "instead of "if $pressed_key" but this didn't work neither): > > checkfrontkeys > set pressed_key = $? > echo "pressed key: " > echo $pressed_key > echo "\n" > > if [ $pressed_key == 1 ]; then > echo "pressed 1" > set default="1" > elif [ $pressed_key == 2]; then > echo "pressed 2" > set default="2" > elif [ $pressed_key == 3]; then > echo "pressed 3" > set default="3" > elif [ $pressed_key == 4]; then > echo "pressed 4" > set default="4" > else > echo "nothing pressed\n" > set default="6" > > fi > > echo "default = ${default}\n" > echo "after checkfrontkeys" > > > > > > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel --------------070706040304040905090804 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sorry,
the source code examples I've sent are from grub.cfg and not from 00_header - in 00_header a $ needs to be escaped with \

Greetings
Joachim

Am 02.05.2012 15:12, schrieb Joachim Mammele:
Hi everybody,

I'd like to add a value to a user variable in 00_header but I get the error "not an assignment".
but if I echo directly the value everything works fine.

What can I do? How can I use a variable my_variable? Is there another way to check for different values of \$?  ?

Any help would be appreciated.

Greetings
Joachim


this is what is working fine:

checkfrontkeys
echo "pressed key: \$?"


-------------

this is what I'm struggling with (I've also been trying to use "case \$? "instead of "if $pressed_key" but this didn't work neither):

checkfrontkeys
set pressed_key = $?
echo "pressed key: "
echo $pressed_key
echo "\n"

if [ $pressed_key == 1 ]; then
    echo "pressed 1"
    set default="1"
elif [ $pressed_key == 2]; then
    echo "pressed 2"
    set default="2"
elif [ $pressed_key == 3]; then
    echo "pressed 3"
    set default="3"
elif [ $pressed_key == 4]; then
    echo "pressed 4"
    set default="4"
else
    echo "nothing pressed\n"
    set default="6"

fi

echo "default = ${default}\n"
echo "after checkfrontkeys"







_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

--------------070706040304040905090804--