bash script assign grep count to variable

How to assign the result of grep -c "some text" /tmp/somePath into variable so I can echo it. Thanks!

some_var = grep -c "some text" /tmp/somePath
echo "var value is: ${some_var}"

I also tried: some_var = 'grep -c \"some text\" /tmp/somePath'

But I keep getting: command not found



To assign the output of a command, use var=$(cmd) (as shellcheck automatically tells you if you paste your script there).

some_var=$(grep -c "some text" /tmp/somePath)
echo "var value is: ${some_var}"

Need Your Help

how to convert list of lists to a set in python so I can compare to other sets?

python list set

I have a list users_with_invites_ids_list, formed by loop where I append values to the list, in python that looks like this:

hello world python extension in c++ using boost?

c++ linux compiler-errors boost-python

Here's my simple first attempt at a python extension using boost. Can someone help me to understand what's causing the compilation error?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.