Mag*_*pie 1 bash background-process
当我像这样从终端运行程序时:
$ program file
Run Code Online (Sandbox Code Playgroud)
例如
$ gedit myfile.txt
Run Code Online (Sandbox Code Playgroud)
我想不出有什么时候我不喜欢使用 '&' 以便我可以在程序运行时释放我的终端以供使用。
有谁知道我可以在哪里或如何将这个“&”设置为这种情况的参数?
您可以创建一个shell函数:
gedit() { command gedit "$@" & }
Run Code Online (Sandbox Code Playgroud)
或者
function gedit() { command gedit "$@" & }
Run Code Online (Sandbox Code Playgroud)
该function
关键字是,至少在理论上,可选的。如果函数名称已定义为别名,则可能有必要;有关详细信息,请参阅此答案。
该命令内置的调用其参数为命令,绕过相同名称的任何壳功能。
将定义添加到您的,$HOME/.bashrc
以便在您启动新 shell 时进行设置。
归档时间: |
|
查看次数: |
70 次 |
最近记录: |