All of lore.kernel.org
 help / color / mirror / Atom feed
* Questions for writing manpages
@ 2008-01-30 22:13 Franklin PIAT
  2008-01-30 22:29 ` Robert Millan
  2008-01-30 22:43 ` Pavel Roskin
  0 siblings, 2 replies; 9+ messages in thread
From: Franklin PIAT @ 2008-01-30 22:13 UTC (permalink / raw)
  To: The development of GRUB 2

Hello,

I have some questions for the writing the documentation[1].

** How to use "If [ $x=foo ] Then Else fi" statement ? 

I've successfully used :
 if [ A=B ] ; then echo "foo" ; else echo "bar" ; fi" 

But I cannot use variables, with either :
 if [ $i=B ] ; then echo "foo" ; else echo "bar" ; fi" 
 if [ X$i=XB ] ; then echo "foo" ; else echo "bar" ; fi" 


** How would you define the "rescue" mode ? In what situation 
can it be useful to the user ?

** Does the "ofconsole" console supports unicode ?

Thanks for your help.

Franklin



[1] "manpages" : http://wiki.debian.org/Grub/Grub2 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-30 22:13 Questions for writing manpages Franklin PIAT
@ 2008-01-30 22:29 ` Robert Millan
  2008-01-30 23:45   ` Franklin PIAT
  2008-01-30 22:43 ` Pavel Roskin
  1 sibling, 1 reply; 9+ messages in thread
From: Robert Millan @ 2008-01-30 22:29 UTC (permalink / raw)
  To: The development of GRUB 2

On Wed, Jan 30, 2008 at 11:13:50PM +0100, Franklin PIAT wrote:
> Hello,
> 
> I have some questions for the writing the documentation[1].
> 
> ** How to use "If [ $x=foo ] Then Else fi" statement ? 
> 
> I've successfully used :
>  if [ A=B ] ; then echo "foo" ; else echo "bar" ; fi" 
> 
> But I cannot use variables, with either :
>  if [ $i=B ] ; then echo "foo" ; else echo "bar" ; fi" 
>  if [ X$i=XB ] ; then echo "foo" ; else echo "bar" ; fi" 

Did you try ${i} and $(i)? (just guessing).

> ** How would you define the "rescue" mode ? In what situation 
> can it be useful to the user ?

Only when something breaks.  For example, when GRUB can't load normal.mod
(and its associated modules), it dumps you to rescue mode.

> ** Does the "ofconsole" console supports unicode ?

No.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-30 22:13 Questions for writing manpages Franklin PIAT
  2008-01-30 22:29 ` Robert Millan
@ 2008-01-30 22:43 ` Pavel Roskin
  2008-01-31 10:51   ` Robert Millan
  1 sibling, 1 reply; 9+ messages in thread
From: Pavel Roskin @ 2008-01-30 22:43 UTC (permalink / raw)
  To: The development of GRUB 2


On Wed, 2008-01-30 at 23:13 +0100, Franklin PIAT wrote:
> Hello,
> 
> I have some questions for the writing the documentation[1].
> 
> ** How to use "If [ $x=foo ] Then Else fi" statement ? 
> 
> I've successfully used :
>  if [ A=B ] ; then echo "foo" ; else echo "bar" ; fi" 
> 
> But I cannot use variables, with either :
>  if [ $i=B ] ; then echo "foo" ; else echo "bar" ; fi" 
>  if [ X$i=XB ] ; then echo "foo" ; else echo "bar" ; fi" 

If we don't care about UNIX from the seventies, this should work fine:

if [ "$x" = "$y" ]; then echo "foo"; else echo "bar"; fi

I guess you don't assign the variables correctly.  Please make sure you
don't use spaces around "=" in assignments, but use them in comparisons.

You can replace echo "foo" with echo "foo$i." to see the value of $i in
the same expression.

> ** How would you define the "rescue" mode ? In what situation 
> can it be useful to the user ?

I think the idea was to move most interactivity to a separate module
called normal.  If that module is not available, the internal "rescue"
mode is used to make it possible to load modules.  I don't know how
practical it is.

> ** Does the "ofconsole" console supports unicode ?

No.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-30 22:29 ` Robert Millan
@ 2008-01-30 23:45   ` Franklin PIAT
  2008-01-31 10:49     ` Robert Millan
  2008-01-31 20:54     ` Pavel Roskin
  0 siblings, 2 replies; 9+ messages in thread
From: Franklin PIAT @ 2008-01-30 23:45 UTC (permalink / raw)
  To: The development of GRUB 2


On Wed, 2008-01-30 at 23:29 +0100, Robert Millan wrote:
> On Wed, Jan 30, 2008 at 11:13:50PM +0100, Franklin PIAT wrote:
> > Hello,
> > 
> > I have some questions for the writing the documentation[1].
> > 
> > ** How to use "If [ $x=foo ] Then Else fi" statement ? 
> > 
> > I've successfully used :
> >  if [ A=B ] ; then echo "foo" ; else echo "bar" ; fi" 
> > 
> > But I cannot use variables, with either :
> >  if [ $i=B ] ; then echo "foo" ; else echo "bar" ; fi" 
> >  if [ X$i=XB ] ; then echo "foo" ; else echo "bar" ; fi" 
> 
> Did you try ${i} and $(i)? (just guessing).

It seems that variable expansion adds a space before and after the variable's value.
Since the test must be "A=B", without space, results seems to be wrong 
(unless i'm doing something wrong).



if [ A=A ]; then echo "foo" ; fi
foo
if [ A=B ]; then echo "foo" ; else echo "bar"; fi
bar
error: false

## WRONG
if [ A = A ]; then echo "foo" ; fi
foo
if [ A = B ]; then echo "foo" ; fi
foo

## WRONG
if [ "A" = "A" ]; then echo "foo" ; fi
foo
if [ "A" = "B" ]; then echo "foo" ; fi
foo

## WRONG
if [ "A" == "A" ]; then echo "foo" ; fi
foo
if [ "A" == "B" ]; then echo "foo" ; fi
foo

## WRONG
if [ A = A ]; then echo "foo" ; fi
foo
if [ A = B ]; then echo "foo" ; fi
foo

## WRONG
if [ A==A ]; then echo "foo" ; fi
error: false
if [ A==B ]; then echo "foo" ; fi
error: false


#### WITH VARIABLES ######
set X=A
echo $X
A
echo $(X)

echo ${X}
A

## WRONG
if [ $X=A ]; then echo "foo" ; fi
foo
if [ $X=B ]; then echo "foo" ; fi
foo

if [ ${X}=A ]; then echo "foo" ; fi
foo
if [ ${X}=B ]; then echo "foo" ; fi
foo

## Variables 
echo ${X}=A
A =A
echo A=${X}
A= A
echo A=$X
A= A
echo "A=$X"
A= A


> > ** How would you define the "rescue" mode ? In what situation 
> > can it be useful to the user ?
> 
> Only when something breaks.  For example, when GRUB can't load normal.mod
> (and its associated modules), it dumps you to rescue mode.
I'll try to simulate that.

> > ** Does the "ofconsole" console supports unicode ?
> No.
Doc updated, thanks.

Franklin




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-30 23:45   ` Franklin PIAT
@ 2008-01-31 10:49     ` Robert Millan
  2008-01-31 20:54     ` Pavel Roskin
  1 sibling, 0 replies; 9+ messages in thread
From: Robert Millan @ 2008-01-31 10:49 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Jan 31, 2008 at 12:45:25AM +0100, Franklin PIAT wrote:
> > > ** How would you define the "rescue" mode ? In what situation 
> > > can it be useful to the user ?
> > 
> > Only when something breaks.  For example, when GRUB can't load normal.mod
> > (and its associated modules), it dumps you to rescue mode.
> I'll try to simulate that.

Simply skip loading of an essential module in core.img, like the partmap or
fs modules for accessing /boot/grub.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-30 22:43 ` Pavel Roskin
@ 2008-01-31 10:51   ` Robert Millan
  0 siblings, 0 replies; 9+ messages in thread
From: Robert Millan @ 2008-01-31 10:51 UTC (permalink / raw)
  To: The development of GRUB 2

On Wed, Jan 30, 2008 at 05:43:03PM -0500, Pavel Roskin wrote:
> > ** How would you define the "rescue" mode ? In what situation 
> > can it be useful to the user ?
> 
> I think the idea was to move most interactivity to a separate module
> called normal.  If that module is not available, the internal "rescue"
> mode is used to make it possible to load modules.  I don't know how
> practical it is.

Very much.  In GRUB Legacy, when something went wrong, you usually just
got a cryptic error.  Now you can go through the whole thing interactively
and see what prevents you from loading normal.mod.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-30 23:45   ` Franklin PIAT
  2008-01-31 10:49     ` Robert Millan
@ 2008-01-31 20:54     ` Pavel Roskin
  2008-01-31 21:28       ` Vesa Jääskeläinen
  1 sibling, 1 reply; 9+ messages in thread
From: Pavel Roskin @ 2008-01-31 20:54 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Franklin PIAT

On Thu, 2008-01-31 at 00:45 +0100, Franklin PIAT wrote:

> It seems that variable expansion adds a space before and after the variable's value.
> Since the test must be "A=B", without space, results seems to be wrong 
> (unless i'm doing something wrong).

Sorry for my previous clueless reply.  I though you were asking about
the normal shell (like bash), not about GRUB command line.

You are right about spaces, I've had this problem before:

> echo (${root})
( hd0,1 )
> ls (${root})
error: unknown device

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-31 20:54     ` Pavel Roskin
@ 2008-01-31 21:28       ` Vesa Jääskeläinen
  2008-01-31 21:32         ` Pavel Roskin
  0 siblings, 1 reply; 9+ messages in thread
From: Vesa Jääskeläinen @ 2008-01-31 21:28 UTC (permalink / raw)
  To: The development of GRUB 2

>> echo (${root})
> ( hd0,1 )
>> ls (${root})
> error: unknown device

Is there a reason why root does not contain (hd0,1) (in this case)

I think there was once change related to ()'s in codebase... perhaps 
this was "broken" accidently?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Questions for writing manpages
  2008-01-31 21:28       ` Vesa Jääskeläinen
@ 2008-01-31 21:32         ` Pavel Roskin
  0 siblings, 0 replies; 9+ messages in thread
From: Pavel Roskin @ 2008-01-31 21:32 UTC (permalink / raw)
  To: The development of GRUB 2


On Thu, 2008-01-31 at 23:28 +0200, Vesa Jääskeläinen wrote:
> >> echo (${root})
> > ( hd0,1 )
> >> ls (${root})
> > error: unknown device
> 
> Is there a reason why root does not contain (hd0,1) (in this case)
> 
> I think there was once change related to ()'s in codebase... perhaps 
> this was "broken" accidently?

No idea.  It did strike me as illogical the first time I ran "set".

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-01-31 21:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 22:13 Questions for writing manpages Franklin PIAT
2008-01-30 22:29 ` Robert Millan
2008-01-30 23:45   ` Franklin PIAT
2008-01-31 10:49     ` Robert Millan
2008-01-31 20:54     ` Pavel Roskin
2008-01-31 21:28       ` Vesa Jääskeläinen
2008-01-31 21:32         ` Pavel Roskin
2008-01-30 22:43 ` Pavel Roskin
2008-01-31 10:51   ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.