Fix for defaults in createuser

Started by Bruce Momjianover 25 years ago3 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Turns out some of the environment variable tests weren't quoted, making
default answers return 'test' failures, i.e.:

! if [ $REPLY = "y" -o $REPLY = "Y" ]; then

fixed to:

! if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Attachments:

/bjm/difftext/plainDownload+52-52
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Bruce Momjian (#1)
Re: Fix for defaults in createuser

Bruce Momjian writes:

! if [ $REPLY = "y" -o $REPLY = "Y" ]; then

fixed to:

! if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then

Good.

FYI, it's never necessary to quote the right side of a shell variable
assignment.

FOO=$BAR

always works, as does

case $foo in ...

But it doesn't hurt of course.

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#3Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#2)
Re: Fix for defaults in createuser

Bruce Momjian writes:

! if [ $REPLY = "y" -o $REPLY = "Y" ]; then

fixed to:

! if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then

Good.

FYI, it's never necessary to quote the right side of a shell variable
assignment.

FOO=$BAR

always works, as does

case $foo in ...

But it doesn't hurt of course.

I see:

$ X="a b"
$ Y=$X

I never realized that. Now I am confused why 'test' needs it, but
assignment doesn't.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026