Search Results

Search: Posts Made By: timiksy
4,647
Posted By timiksy
I got it to work with Scrutinizer's $ if [...
I got it to work with Scrutinizer's
$ if [ "$(echo "if (1.1 == 1.10) 0 " | bc)" -eq 0 ] 2>/dev/null; then echo "great"; else echo "no go"; fi
no go
Thank you so much for the help, guys!
4,647
Posted By timiksy
hmm it still doesn't work as expected: if [...
hmm it still doesn't work as expected:

if [ $(echo "1.1 == 1.1" | bc) -eq 0 ]; then echo "great"; else echo "no go"; fi
syntax error on line 1, teletype
-bash: [: -eq: unary operator expected...
4,647
Posted By timiksy
no :( /usr/xpg6/bin/bc 1 > 2 syntax...
no :(

/usr/xpg6/bin/bc
1 > 2
syntax error on line 1, teletype

Some more relevant info:
I'm writing my script on an instructional account, so apparently, the version of bc in the system is...
4,647
Posted By timiksy
Sun 5.10 edit: and yes, I do get the...
Sun 5.10

edit:
and yes, I do get the error instead of 0. Same if I try to use it interactively:

bc
1 > 2
syntax error on line 1, teletype
4,647
Posted By timiksy
I guess I didn't change it in time, sorry. Should...
I guess I didn't change it in time, sorry. Should be:
echo '1 > 2' | bc
I've tried both " " and ' ', though, and neither work
4,647
Posted By timiksy
bc error
Whenever I use bc to compare two numbers, I get a "syntax error on line 1, teletype" error. I've tried simpler expressions like
echo '1 > 2' | bc
...but the error still occurs. Is it a problem...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 08:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy