I though your correction would work, but the output still gives me the
error message. I would really like to fix it, but will settle for not
seeing the error.
#!/bin/bash
if [$1 == '']; then
echo ''
echo "format is $0 'math equation'"
echo "i.e. $0 (2+2)*3"
echo ''
exit
fi
echo $1 | /usr/bin/bc -l 2>/dev/null
david
On Wed, 11 Dec 2002, Robert P. J. Day wrote:
> On Wed, 11 Dec 2002, Francisco Neira wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > dbrett wrote:
> > | I have a bash to math calucations. It works but also complains about the
> > | last line, even though it works.
> > |
> > | Any ideas how to fix the problem or at least not see the error message and
> > | still work.
> > |
> > | #!/bin/bash
> > |
> > | if [$1 == '']; then
> > | echo ''
> > | echo "format is $0 'math equation'"
> > | echo "i.e. $0 (2+2)*3"
> > | echo ''
> > | exit
> > | fi
> > |
> > | echo $1 | /usr/bin/bc -l &2>/dev/null
> > |
> > | unfortunately '&2>/dev/null has an additional problem.
> > |
> > | david
> > |
> > |
> > |
> > |
> > |
> >
> > And 2>&1 /dev/null works?
>
> if all you want to do is not see the error message, append "2>/dev/null".
> there's no need for the "&" in what you're doing.
>
> rday
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
> https://listman.redhat.com/mailman/listinfo/redhat-list
>
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list