RE: Questions on RPM

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

 



--- Rayapudi Sandeep-mgb376 <rsandeep@xxxxxxxxxxxx> 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  

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux