Please consider offering answers and suggestions to help other students!
And if you fix a problem by following a suggestion here,
it would be great if other interested students could see a short
"Great, fixed it!" followup message.
> Is BC allowed as part of our code or is BC classed as something "advanced" and using it will limit our score to a maximum of 12?
Hi Nathan, short answers are No and Yes. Longer answer, bc is a small language similar to awk in concept, though more limited. The point of this assignment is get you using the language structures we have covered in the unit, literate programming, antibugging, etc. In addition, ise of more advanced (for now) features unfairly disadvantages those who really are tackling the material for the first time. Fair enough?
Cheers
MichaelW
🧑🎨
Hi,
I wouldn't class the read command as advanced. It's just that we've not covered it yet as it's related to loop structures, which we only get to do next teaching week. Please just use the stuff we've covered - for now. Trainer-wheels will come off, or at least will be substantially reduced - for the second assignment.
Cheers
MichaelW
> "Nathan Reed" <24*1*0*4@s*u*e*t*u*a*e*u*a*> wrote:
>
> > Is BC allowed as part of our code or is BC classed as something "advanced" and using it will limit our score to a maximum of 12?
>
> Hi Nathan, short answers are No and Yes. Longer answer, bc is a small language similar to awk in concept, though more limited. The point of this assignment is get you using the language structures we have covered in the unit, literate programming, antibugging, etc. In addition, ise of more advanced (for now) features unfairly disadvantages those who really are tackling the material for the first time. Fair enough?
>
> Cheers
> MichaelW
> 🧑🎨
Thank you for this professor, I am still confused that can we use bc or no, Kindly respond because in one condition without using bc I am facing issue.
Also one more question in the below sample .sh for file has not been included, is it necessary to remove it because, when I am running on my system I need to add .sh or else I have error.
Kindly clear my this doubt
% tobacco_nation WHO_tobacco_control_tonly.csv 2030 Female
The global maximum percentage of Female tobacco users in 2030 is predicted to be in Andorra (AND) at 42.3
> Hi Sir,
> Thank you for the response, I have one more question, Can I use scaling like printf "%.0f" to compare floating point values
Hi Suman,
I don't really understand the question. Bash printf prints data to standard output. I can't see how you can use Bash's printf to compare floating point values. Sorry. Confused. (Bash only supports integer arithmetic - which we'll cover shortly
Cheers
MichaelW
> Also one more question in the below sample .sh for file has not been included, is it necessary to remove it because, when I am running on my system I need to add .sh or else I have error.
> Kindly clear my this doubt
>
> % tobacco_nation WHO_tobacco_control_tonly.csv 2030 Female
> The global maximum percentage of Female tobacco users in 2030 is predicted to be in Andorra (AND) at 42.3
Hi,
If you are running the standard Ubuntu/Bash/Gnu-Shell-Tools set up, having the .sh on the end of file name should not matter. Instead you need the #!/usr/bin/env bash as the first line. (To my taste, having .sh at the end of Shell script is misleading unless you intend to use sh (ie the original Shell, of which Bash is a derivative.).
Cheers
MichaelW
Hi,
Thank you for the response,
I mean I can convert it into int first without decimal like printf "%.0f", variablename and store it in other variable and then compare.
just let me know if this can be valid
Hi,
This makes no sense to me. If you are able to capture a floating point real in this way (outside of Awk), you will comparing strings, which is not a good idea if you actually are working with numbers (see the discussion on arithmetic versus string comparisons).
Cheers
MichaelW