Sponsored Content
Top Forums Shell Programming and Scripting (standard_in)1:syntax error using bc with Cron Post 303020407 by Don Cragun on Wednesday 18th of July 2018 01:54:04 PM
Old 07-18-2018
I would expect echo '(1.8*$celsius+32)' | tr -d '\n' | bc -l to give you the diagnostic message you showed us since bc input needs to be a text file and, by stripping off the <newline> character with the tr element in your pipeline, bc is not getting a text file as input.

You should not get that error with echo "1.8*$celsius+32" | bc -l or with echo "1.8*$celsius+32" | bc, but you might get a different error if the celsius variable has not been set to a numeric string value.

Assuming you're trying to get a floating point result, if you have a 1993 or later version of ksh available on your system (in addition to bash), you could use the much more efficient:
Code:
fahrenheit=$((1.8*$celsius+32))

This User Gave Thanks to Don Cragun For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

2. AIX

nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error

-------------------------------------------------------------------------------- Hello, help me please. I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? : Command : failed stdout: yes stderr: no... (9 Replies)
Discussion started by: astjen
9 Replies

3. Solaris

please review this cron syntax

Dears if i want to run this job every Saturday at 6 AM that will be the code * 6 * * 1 cd /export/home/jenova ; ls -ltr >> $HOME/jenova_dir (2 Replies)
Discussion started by: jenovaux
2 Replies

4. Shell Programming and Scripting

(standard_in) 1: parse error

Hi all, Could someone please to tell me when do we exactly get the below error and how to get rid of it. I am unable to trace the error. (standard_in) 1: parse error Thanks in advance !! (4 Replies)
Discussion started by: sparks
4 Replies

5. Shell Programming and Scripting

bc giving error: (standard_in) 2: parse error

Below part of script, is working fine sometimes and gives error sometime. I am doing float operations, checking if x > y. ##########CODE########## THRESHOLD="1.25" ratio=$( echo "scale=2; ${prev}/${current}" | bc ) if ; then split_date=`echo ${line} | cut -d, -f2` fi ... (9 Replies)
Discussion started by: manishma71
9 Replies

6. Shell Programming and Scripting

(standard_in) 1: parse error

Hi, I am trying to make a script that tries to compare two values and print if one is greater than another. It seems to return a (standard_in) 1: parse error at times. #!/bin/sh a= awk '{print $1}' file1.txt b= awk '{print $1}' file2.txt c= awk '{print $1}' file3.txt x= awk '{print... (5 Replies)
Discussion started by: jamie_123
5 Replies

7. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies

8. Shell Programming and Scripting

Standard_in error

# echo '6.5 < 2.7 ' |bc 0 # echo '4.8.5 > 4.8.4' |bc (standard_in) 1: syntax error (standard_in) 1: syntax error ---------------------------------------------------------- FILESET_A_VER_CHK2=4.8.5 FILESET_R_NAME_CHK2=4.8.5 if ] ; then ## echo "Fileset is higher " ... (2 Replies)
Discussion started by: Mathew_paul
2 Replies

9. UNIX for Advanced & Expert Users

Command syntax error in cron

SCO OSR 507, user's shell is old Bourne sh The same command is OK when run using now, but fails when run in cron, see below: 1) using now, see how it worked and I see resulting DT=2018 in the mail $ at now { dt=`/usr/gnu/bin/date '+%Y'`; echo "DT=$dt"; } job 1522867418.a-6605:0 at Wed... (2 Replies)
Discussion started by: migurus
2 Replies
Device::USB::PCSensor::HidTEMPer::NTC::External(3pm)	User Contributed Perl Documentation   Device::USB::PCSensor::HidTEMPer::NTC::External(3pm)

       Device::USB::PCSensor::HidTEMPer::NTC::Internal - The HidTEMPerNTC external sensor

VERSION
Version 0.02 SYNOPSIS
None DESCRIPTION
This is the implementation of the HidTEMPerNTC external sensor. CONSTANTS o MAX_TEMPERATURE The highest temperature(150 degrees celsius) this sensor can detect. o MIN_TEMPERATURE The lowest temperature(-50 degrees celsius) this sensor can detect. o INITIAL_GAIN The initial gain value used to calculate voltage returned o CALIBRATION_VALUES Values used to calculate Volt7705Calibration METHODS o new() Returns a new External sensor object. o celsius() Returns the current temperature from the device in celsius degrees. The formula used to calculate value based on a calibrated key value is created using the Eureqa tool from Cornell Computational Synthesis Lab, http://ccsl.mae.cornell.edu/eureqa. Resulting in the use of this formula instead of the provided number list: f(y)=66.7348/(66.7275/(67.8088 - 9.70353*log(0.000251309 + y*y)) - 0.21651) If you find another formula that is more accurate please drop me a line. The data used can be found in the source code of this file. INHERIT METHODS FROM
Device::USB::PCSensor::HidTEMPer::Sensor DEPENDENCIES
This module internally includes and takes use of the following packages: use Carp; use Time::HiRes qw / sleep /; use Device::USB::PCSensor::HidTEMPer::Sensor; This module uses the strict and warning pragmas. BUGS
Please report any bugs or missing features using the CPAN RT tool. FOR MORE INFORMATION
None AUTHOR
Magnus Sulland < msulland@cpan.org > ACKNOWLEDGEMENTS
This code includes findings done by Robin B. Jensen, http://www.drunkardswalk.dk, when converting the received hex values into volt. COPYRIGHT &; LICENSE Copyright (c) 2010 Magnus Sulland This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-07-24 Device::USB::PCSensor::HidTEMPer::NTC::External(3pm)
All times are GMT -4. The time now is 04:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy