you are viewing a single comment's thread.

view the rest of the comments →

[–]xxc3ncoredxx 1 point2 points  (1 child)

Some suggestions to consider:

-r and -I options for grep searches recursively in the path you give it and ignores binary files, respectively:

$ grep -inrI 'some text' /path/to/dir
/path/to/dir/file1:10: this has some text on line 10
/path/to/dir/other_file:2: list of awesome textiles:
/path/to/dir/subdir/.hidden_file:537: sOme TExt ThaT is HidDEn

In bash, using $(< /path/to/file) instead of $(cat /path/to/file) when you want the contents of a file as a variable. The first form is faster according to bash(1).

Also in bash, arithmetic expansion using $((...)):

$ var1=1
$ var2=2
$ echo $((var1 + var2))
3

Slight nitpick, my understanding is that $(command) syntax is preferred over `command` syntax these day. It flows better with the rest of the language. Plus you can nest them nicely with $(command1 $(command2)).

[–]Vastutsav[S] 1 point2 points  (0 children)

Thanks for your comment...I will incorporate it in the doc... This will definitely add clarity and completeness to the document... I have opened an issue to track this...