-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 7 Sep 2010 23:04:56 +0300 Zvi Dubitzky <d...@il.ibm.com> wrote:
> Hi > > 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!" cat file else # Exit condition... echo "Didn't find XY!" echo "Check XX and YY that there is in fact what you need." fi 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 return $? 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!) - -- Morgan Gangwere 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) iQIcBAEBAgAGBQJMhp2FAAoJEEURiCSotvJDDYsP/225jXM8dx14JZb2rqsDJ3Tt SiBa+kI11yMf/wjkDYEKgdXmhtgeS+4Z1toCZy6dqXD1wmZZb5xHZpH6sm+kdiXl e3yqaLT9NM8odQx2oqxKQJbDaFUXLIWFXC6QZPwH8hNwSbgSjL7f+OdL8YmTfnuz atHWIXzKfy+iFc+VDavyDvXrPjAVd/1gIKfEK2Se8cW896T+ttJCD+NwFrYsAMv0 A+4VyC5w/deXL2SKJRh/Cu1DW5x5LPnKeOgUNOI7nOazZmkzueq8JXA5G0NvBEkx Um0trcY5atnbFm9rc0qm5zgLCSeT1OZyJqhH1psc891xE/EPWSpsoVb00kHtNSM9 AlPkOblxmfJSD3Nu4QK1uS1sgEB9GOQfE5dFnMhYt3QBMz9qdiodbfMlrtu7yj57 KRSi/OBLO0i/UcdL4t7qhFL1d6tlkIrmi3iHbdrp0lRKFD9cLDhJVGhNhk+PJbC0 6nf/pNrho+qkHY4FOF6giDW102A6kOAIz+OOwz/wQJTe+V1yVvmSKQOgKIr5cnBc O6lcxDUHQOI54PMCjCsvUTknWcVeJsnOxwQpqMjdCIjWqrVTLCZ9kOmKiylkx+p/ lNH/ggF3zfPpOp8NU90De1IEw7iw1ttTjexgNLnw/2Jid9fm7KDclW4S3Kz44mtZ qlzTZwE0XTj74shP0wMX =+RkU -----END PGP SIGNATURE-----