Doubt in milestone 1 of module 2

I am not able to understand the 3rd TODO:-

TODO: CRIO_TASK_MODULE_SERVER_CONFIGURATION

# Tasks:

# 1) Add the line to populate the variable "totalMemInKB" with the value of the Total Free memory in KB.

# 2) Linux commands can be placed within the `` when assigning the output to a variable. 

#    E.g. totalMemInKB=`<bash command>`

# 3) Start the expression to populate the variable with "cat $1" which is the command line filename input. Check the Usage above. 

# 4) Execute the script before submission and confirm the output

You have to see CPU information and assign an appropriate value to the variable “totalMemInKB”. Search how to see CPU information on Linux on the internet.

I figured out how to assign the free memory to the given variable, I just don’t know what is to be done with the 3rd TODO

Hey @fakerodeo . The third TODO is giving you a clue on how you should go about using the parameter passed during the shell execution. Hope this helps. :slightly_smiling_face:

everytime it gives incoorect invocation of script…any help?

Read the comments. To run the script you have to pass an argument.
Failing to pass an argument when executing the script gives the error.

Should we check for total memory in system or for Total free memory available presently?
Milestone task asks to check total memory installed in system.
The To Do however asks to check with Total Free Memory.

Please go ahead with “Total memory”

Hey, @fakerodeo
I have stored “MemTotal: 2002424 kB” into variable totalMemInKB
but how do i extract the Integer part of this …that is 2002424
Please help me !

You can use regular expressions i guess

One way can be to extract only numbers from the string[regex]

i have used ‘awk’ along with ‘grep’ and its working fine !
Thankyou anyways @virajbukitagar123 and @sghosh

you may also use translate(tr) command refer https://www.geeksforgeeks.org/tr-command-in-unix-linux-with-examples/

1 Like