Search Results

Search: Posts Made By: wisecracker
12,443
Posted By wisecracker
As an addendum the 'bash' code works inside...
As an addendum the 'bash' code works inside 'dash' too, without alteration except the shebang to point to 'dash' so therefore it is POSIX compliant...
In this case Linux Mint #!/bin/dash , and in...
12,443
Posted By wisecracker
You wanted the python code in bash so don't run...
You wanted the python code in bash so don't run before you can walk!
The code, (#11), CAN be improved, it also has no error detection nor reporting, it has no means of going over a persons wrongly...
12,443
Posted By wisecracker
Here you go in bash, this REQUIRES integer number...
Here you go in bash, this REQUIRES integer number input for salary:
You will have to work out how to use floating point for input, it would be tedious but a draft so far...

#!/bin/bash

: >...
12,443
Posted By wisecracker
I have already stated that bash ONLY has integer...
I have already stated that bash ONLY has integer maths, so let's see its limitations:
q1=6; q2=7; q3=5; q4=7
av1=$(( (q1+q2+q3+q4)/4 ))
echo "$av1"
# Gives the result 6. WRONG! The REAL answer is...
12,443
Posted By wisecracker
Hi rohit_shinez... (Apologies for any typos.) ...
Hi rohit_shinez...
(Apologies for any typos.)
In bash? Hmm, awk - most probably as it has builtin scientific maths and floating point capability, but I am no expert.
Bash has ONLY integer maths...
12,443
Posted By wisecracker
Hi rohit_shinez: IMHO I don't think you will...
Hi rohit_shinez:

IMHO I don't think you will be able to better Python for your use here, of which your version is 2.x.x.
It might be a better bet to translate to Python 3.x.x, (currently 3.7.x...
Showing results 1 to 6 of 6

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