I want to make my custom alias for searching text inside the directory recursively. Currently i use this
grep -r "text to search" /var/www/sites
I want first
myalias
so that from command line i use only this myalias text-to-search (without quotes)
Is this possible
Put this in your ~/.bashrc:
wwwgrep() {
find /var/www/sites -name '*.php' -o -name '*.html' -exec grep -Hn "$1" {} \;
}
Then
wwwgrep <PATTERN>
Finally (to refresh your environment)
exec bash
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.