It's UWAweek 17 (1st semester, week 8)

helpOSTS

This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting.

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.

How do I ask a good question?
Displaying the 7 articles in this topic
Showing 7 of 170 articles.
Currently no other people reading this forum.


 UWA week 14 (1st semester, non-teaching week) ↓
SVG not supported

Login to reply

👍?
helpful
4:07pm Wed 3rd Apr, Michael W.

"Suman Inamdar" <23*9*4*9@s*u*e*t*u*a*e*u*a*> wrote:
> 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


SVG not supported

Login to reply

👍?
helpful
4:12pm Wed 3rd Apr, Michael W.

ANONYMOUS wrote:
> 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


SVG not supported

Login to reply

👍?
helpful
7:17am Thu 4th Apr, Nathan R.

Thanks for clarifying Michael. I've gotten ahead of myself with the textbook ;-). Will find a new solution!


SVG not supported

Login to reply

👍?
helpful
9:35am Thu 4th Apr, Michael W.

"Nathan Reed" <24*1*0*4@s*u*e*t*u*a*e*u*a*> wrote:
> Thanks for clarifying Michael. I've gotten ahead of myself with the textbook ;-). Will find a new solution!
Hi Nathan, Textbook? How wonderfully old-fashioned 😉👍. Which one are you using, please? Cheers MichaelW 🧑‍🎨


SVG not supported

Login to reply

👍?
helpful
1:20pm Thu 4th Apr, ANONYMOUS

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


SVG not supported

Login to reply

👍?
helpful
2:45pm Thu 4th Apr, Michael W.

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


 UWA week 15 (1st semester, week 6) ↓
SVG not supported

Login to reply

👍?
helpful
1:26pm Thu 11th Apr, Nathan R.

Hi Michael, I've been using "The Linux Command Line" (5th Edition) by William Shotts.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy