如何创建带参数的grep别名 [英] How to create grep alias with arguments

查看:160
本文介绍了如何创建带参数的grep别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我有这个搜索词:

Lets say i have this search term:

grep -i -r --include=*.xib "img_28301.png" ./

如何将我去创造一个别名,可以让我做到这一点:

how would i go about creating an alias that allows me to do this:

xibsearch img_28301.png 

和做同样的事情?

推荐答案

这将是干净多了有一个功能是:

It will be much cleaner to have a function for this:

xibsearch() {
    grep -i -r --include=*.xib "$1" ./
}

由于别名不支持位置参数。

As alias doesn't support positional parameters.

这篇关于如何创建带参数的grep别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆