[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
RE: Questions on RPM
- From: Stephen Cameron <smcameron yahoo com>
- To: RPM Package Manager <rpm-list redhat com>
- Subject: RE: Questions on RPM
- Date: Fri, 1 Jun 2007 10:53:50 -0700 (PDT)
--- Rayapudi Sandeep-mgb376 <rsandeep motorola com> wrote:
> I had another issue with RPM.
>
> - I need to read some variables from user (with shell command 'read')
> and based on that, I will execute some other shell scripts (creating a
> database). But when execution comes to 'read' in spec file, it says,
> "/var/tmp/rpm-tmp.35565: line 4: [: =: unary operator expected". Please
> suggest me. Please find shell scripts and spec file here.
>
> ****spec file*****
> %pre
> echo "In pre install script"
> cd /usr/src/redhat/BUILD/rpmTest-%{version}
> read a
> if [ $a = "y" ]
> then
> sh createDb.sh /home/motorola/CallerId-1.1/
> Fi
You need to quote $a.
[scameron quandary ~]$ if [ = a ]; then
> echo hello
> fi
bash: [: =: unary operator expected
[scameron quandary ~]$
a has the value "", that is, an empty string.
You need to quote it so the shell can see it.
if [ "$a" = "whatever" ]
then
blah
fi
You're also going to get people telling you
RPMs shouldn't be interactive (do configuration
_after_ the install, instead.)
But that has nothing to do with why the script is
dying, of course.
-- steve
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]