Module 2 -Milestone 2- unable to place cat output in a variable

In module 2, Milestone 2 -
I’m able to see the CPU speed using - cat /proc/cpuinfo | grep ‘cpu MHz’ -m1| awk ‘{print$4}’|cut -d. -f1
Now question is how can i place this in a variable. I tried a lot. Not getting any solution. Can any one help (edited)

Hi @rhuded
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

Hi @rhuded,

You can just store the results returned by the command you have specified in a variable by executing the same command inside the script.

@Shorya-Crio.do-TA : I didn’t get you. will you please elaborate. At present i’m unable to save the result of cat command in a variable. If you give an example it will be helpful.

Yeah sure. Check out this link: https://www.cyberciti.biz/faq/unix-linux-bsd-appleosx-bash-assign-variable-command-output/

cpuSpeedInMHiz=cat /proc/cpuinfo|grep 'cpu MHz' -m1|awk '{print$4}'|cut -d. -f1

resolved !

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.