Skip to main content
deleted 203 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 238

I am having a hard time understanding what the following grep command is actually doing and would like to get some guidance. I have tried to search everywhere online and even tried looking with the man.

Here isConcerning the command(s):

path=$1  # ---> I am not entirely sure what this means either
if grep -q -rHl --include \*.c --include \*.h "int main" $path 

So what I do understand is that it is recursively looking for .c and .h files which include "int main" within their contents and wants to echo the name of the file as well. 

But what exactly does the "$path" mean and do?

I am having a hard time understanding what the following grep command is actually doing and would like to get some guidance. I have tried to search everywhere online and even tried looking with the man.

Here is the command(s):

path=$1  # ---> I am not entirely sure what this means either
if grep -q -rHl --include \*.c --include \*.h "int main" $path 

So what I do understand is that it is recursively looking for .c and .h files which include "int main" within their contents and wants to echo the name of the file as well. But what exactly does the "$path" mean and do?

Concerning the command(s):

path=$1  # ---> I am not entirely sure what this means either
if grep -q -rHl --include \*.c --include \*.h "int main" $path 

So what I do understand is that it is recursively looking for .c and .h files which include "int main" within their contents and wants to echo the name of the file as well. 

But what exactly does the "$path" mean and do?

added 11 characters in body
Source Link
filbranden
  • 22.6k
  • 4
  • 65
  • 87

I am having a hard time understanding what the following grep command is actually doing and would like to get some guidance. I have tried to search everywhere online and even tried looking with the man.

Here is the command(s):

path=$1 ---> I am not entirely sure what this means either

if grep -q -rHl --include *.c --include *.h "int main" $path

path=$1  # ---> I am not entirely sure what this means either
if grep -q -rHl --include \*.c --include \*.h "int main" $path 

So what I do understand is that it is recursively looking for .c and .h files which include "int main" within their contents and wants to echo the name of the file as well. But what exactly does the "$path" mean and do?

I am having a hard time understanding what the following grep command is actually doing and would like to get some guidance. I have tried to search everywhere online and even tried looking with the man.

Here is the command(s):

path=$1 ---> I am not entirely sure what this means either

if grep -q -rHl --include *.c --include *.h "int main" $path

So what I do understand is that it is recursively looking for .c and .h files which include "int main" within their contents and wants to echo the name of the file as well. But what exactly does the "$path" mean and do?

I am having a hard time understanding what the following grep command is actually doing and would like to get some guidance. I have tried to search everywhere online and even tried looking with the man.

Here is the command(s):

path=$1  # ---> I am not entirely sure what this means either
if grep -q -rHl --include \*.c --include \*.h "int main" $path 

So what I do understand is that it is recursively looking for .c and .h files which include "int main" within their contents and wants to echo the name of the file as well. But what exactly does the "$path" mean and do?

Source Link

How would I interpret this grep command which includes $path?

I am having a hard time understanding what the following grep command is actually doing and would like to get some guidance. I have tried to search everywhere online and even tried looking with the man.

Here is the command(s):

path=$1 ---> I am not entirely sure what this means either

if grep -q -rHl --include *.c --include *.h "int main" $path

So what I do understand is that it is recursively looking for .c and .h files which include "int main" within their contents and wants to echo the name of the file as well. But what exactly does the "$path" mean and do?