grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions for writing manpages


From: Franklin PIAT
Subject: Re: Questions for writing manpages
Date: Thu, 31 Jan 2008 00:45:25 +0100

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]