Re: postinst script
-----BEGIN PGP SIGNED MESSAGE-----
On Tue, 7 Sep 2010 23:04:56 +0300
Zvi Dubitzky <DUBI@il.ibm.com> wrote:
> I have a command line in postinst script of a package that works ok
> outside a package install context .
> one line is causing an error :
> cat /proc/file | grep XY > file
grep returns 1 if it doesn't something that matches your expression.
add an echo if you don't care about your result or you want to change
something along the way....
cat /proc/file | grep XY > file
if [ $? -eq 0 ]; then
# Success condition...
echo "Found XY!"
# Exit condition...
echo "Didn't find XY!"
echo "Check XX and YY that there is in fact what you need."
By default (if my bash-fu is correct), $? (if we're talking bash) will
result in the last return call.. So if i have a script which calls
grep test /proc/file
last and doesn't actually call exit or return, $? will contain the
return value of grep as though you had said
So, either check what you're doing with grep (which may be your biggest
problem!) or eat the value of $? by calling an echo "" (or just return!)
Key ID A8B6F243, available from MIT.
BOFH excuse #301:
appears to be a Slow/Narrow SCSI-0 Interface problem
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-----END PGP SIGNATURE-----