I use the following command syntax to search params in my script
grep -qsRw -m1 “any_param” /dir/…./
Some times the search take avery long time
The question is how to add time out to grep command
For example after 20 seconds grep will break out
If it not illegal to add time out to grep , how it will possible on other way?
THX
Yael
There is a Linux command
timeoutthat can do this for you. Just runEDIT: If you don’t have access to
timeout, you could try this:Afterwards, the process ID of the
grepcommand will be available as the Bash variable$!. (I assume you’re running Bash… if not, it’d help to specify your shell in the question)