自动将一些内容添加到bash命令的末尾 [英] Add something automatically to the end of bash command

查看:48
本文介绍了自动将一些内容添加到bash命令的末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在特定bash命令的末尾添加一些内容,而不必显式键入它.

I would like to know how to add something to the end of a specific bash command without having to type it out explicitly.

例如,我想输入:

$ mycommand argument

,该行将提交为:

$ mycommand argument &

我知道如何在我的 .bashrc 中设置别名(例如),这将允许我添加非位置参数,但是我不知道如何添加一些内容.

I know how to set up an alias in my .bashrc (e.g. alias command="command -i") which will let me add non-positional arguments but I can't figure out how add something to the end.

推荐答案

定义shell函数.

mycommand () {
  command mycommand "$@" &
} 

这篇关于自动将一些内容添加到bash命令的末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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