help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Searching inside files in a script


From: Khan Smith
Subject: Searching inside files in a script
Date: Tue, 12 Oct 2021 22:41:57 +0200

   How can I introduce an option in my bash script file to select either
   /bin/bash or /usr/local/bin/bash?

   Sent: Tuesday, October 12, 2021 at 8:17 PM
   From: "Tapani Tarvainen" <bash@tapanitarvainen.fi>
   To: help-bash@gnu.org
   Subject: Re: Searching inside files in a script
   On Tue, Oct 12, 2021 at 09:42:11PM +0200, Khan Smith
   (khansmith@mail.com) wrote:
   > [1][1]https://mywiki.wooledge.org/BashFAQ/032
   >
   > That is too complicated for me. I have
   >
   > grep -r "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}"
   Try this:
   TIMEFORMAT='%R'
   tim=$( { time grep -r "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}"
   >/dev/null; } 2>&1)
   TIMEFORMAT can also contain %U for user time or %S for system time
   (and some other stuff as well, see bash man page for details).
   If you wish to save the grep output, redirect it to a file rather than
   /dev/null.
   --
   Tapani Tarvainen

References

   1. https://mywiki.wooledge.org/BashFAQ/032


reply via email to

[Prev in Thread] Current Thread [Next in Thread]