I used this script: #!/bin/bash inputtemp=$1 unit=${inputtemp: -1}…
- User
I used this script: #!/bin/bash
input_temp={input_temp: -1} value=${input_temp:0:-1}
if [ (echo "Kvalueresult elif [ (echo "Cvalueresult fi
- Assistant
It looks like the main issue is with how you're concatenating the temperature value and the unit. The current script only returns the unit without the value because
bcmight be stripping away the output. One way to control this is to make sure thatbcdoesn't strip away the output.You can fix this by using
echoto print the result at the end and make sure to avoid using spaces when concatenating the temperature value and the unit. Here's an improved version of your script:bash