linux - 如何在链中使用 grep 作为别名
问题描述
cdl ()
{
cd $1
ls
}
所以我通过运行在我的 bash_aliases 文件中使用上述内容cdl /lib/systemd/systemd
。
我的问题是如何添加 grep 。我希望能够做类似的事情 cdl [/path] [grep query]
也许像
cdlg ()
{
cd "$1"
ls | grep -ni
}
解决方案
cdlg ()
{
cd "$1"
ls | grep -ni "$2" -
}
推荐阅读
- google-cloud-platform - 使用 Google Cloud Platform 和 AI Platform 提供预测服务
- prestashop - Prestashop 1.6 - 我的产品如何从我的模块的 php 页面购物
- angular - 创建一个可观察对象链并在所有对象完成后返回一个可观察对象
- db2 - 如何将 DB2 DDL 和 DML 审计日志编写为系统应用程序日志?
- rest - 如何使用 Pentaho REST API 删除文件
- go - 如何在新进程中执行方法
- javascript - 使用 API 进行分页
- php - 桌面网站上的汉堡菜单(带有小尺寸图标)用于切换单击时的全宽和高度下拉菜单(Bootstrap 4)
- python - 如何从 /etc/oratab 文件中提取字符串?
- python-3.x - ValueError: complex() arg 是格式错误的字符串