variables - Please help me, How to show number five in my bash script? -


my script

#!/bin/bash clear echo -n "number 1 : " read bil1 echo -n "number 2 : " read bil2 krng=$(echo $bil1 - $bil2 |bc -l |sed -e 's/^\./0./' -e 's/^-\./-0./'); echo " result : $bil1 - $bil2 = $krng "  

if input " -1 " $bil1 , "-6" $bil2,why result error ?

this visual

number 1 : -1 number 2 : -6 (standar_in) 1: syntax error result : -1 - -6 =  

i want

your result : -1 - -6 = 5 

how show number 5 in bash script

you can let 2 numbers calculate using keyword 'let'

e.g. i=1 j=2 let k=$i+$j or let k=$i-$j

thus $k=3 or $k=-1


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -