Module 2 Milestone 1 error

I am getting the line below :
Incorrect invocation of script. Usage: ./ /proc/meminfo

whenever I am trying to run this script

1 Like

Well, the error is pretty much self-explanatory. It’s telling you the correct usage of the script. Try running it as stated in error. Also, the script has useful comments, do give it a read.

This will help you out.

I changed the permissions using chmod but still getting permission denied. How to resolve this ?

Did you change owner and group both?

I just used chmod +x as given in above document to make file executable. Don’t know anything about owner or group. Please help. I m stuck at this point since yesterday.

1 Like

You can use sudo chmod +x <file_name>

If that doesn’t work you can paste your error here.
Note - Don’t post your code


Incorrect invocation of script. Usage: ./ /proc/meminfo

If i use this command in usage , i am getting error as shown in snippet

Are you hardcoding /proc/meminfo anywhere inside your script, like at line 23?

No, at line 23 i am just assigning value to a variable using awk and grep .

same error is comng for me, however if I remove the if condition at the top, the code works perfectly. Can anyone explain what is happening?

Are you getting the correct output now ?

@gouravsardana I have attached the snippet of the error. Please let me know how to resolve .

Its look like your file is not executable yet. Check the file permissions using ‘ls -l’.
If the file is not executable the use sudo chmod +x file_name.

yeah i hard coded and fetched the numerical value using awk but yet i m getting the following error.
Incorrect invocation of script. Usage: ./ /proc/meminfo

Using ls -l , i found that the file is executable. I’ m getting -rwxrwxr-x . So, file is executable. But it keeps showing permission denied

same with me…i m including /proc/meminfo while storing value in variable. Maybe we have to do it in different way.

First I didn’t understood the meaning of first if statement later browsing through some resources I have got an idea about it. Before executing please find the meaning of first if statement