Arguments passing

how to use cat $1 so that only one argument will be passed and it exits from if statement of module 2 milestone 1

if test $# -ne 1{


}

Hi @hrithik_cr7
Looks like you are facing challenges in the current module.

Below is a link to all the FAQ’s for the current module

Below are a few similar topics raised by other users which you might find usefull

Note - This is a BETA Feature,if you find this helpful, kindly let us know.
Feedback link - https://forms.gle/cmxN5pdTXgnwgC986

Kindly mark this as a solution if this has helped you solve your query

still I didn’t got the solution I am stuck at that if statement at beginning I know it requires one argument to exit but I am not able to do it

Hi Hritik,

We have given

Usage: ./check_QBox_server_memory.sh /proc/meminfo"

What are we expecting here?? we want you to make use of command line arguments,
The code you have written contain “/proc/meminfo”, can you think of a way to use it from command line?

Our TODO gives a hint

  1. Start the expression to populate the variable with “cat $1” which is the command line filename input. Check the Usage above.

So try to use “cat $1” in the code that you have written, instead of hard coding /proc/meminfo

(Also you need not worry about the if condition block, all you need to do is “Add the line to populate the variable “totalMemInKB” with the value of the Total memory in KB.” as given in TODOs")

(And please do not post any Screenshot that contains the code that you have written)

I

I am getting an error - insufficient memory

–help-please

sorry for posting images and I got what you said ,
I used cat $1 and passed the arg required thanks it helped

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.