简体   繁体   English

如何处理别名中的多个输入?

[英]How to handle multiple inputs in alias?

I am using tcsh shell. 我正在使用tcsh shell。

Currently I have the following alias which I intend to expand. 目前,我打算扩展以下别名。

alias e 'emacs \!:* &'

I want to create an alias which opens files from a previous directory 我想创建一个别名来打开先前目录中的文件

alias ep 'emacs ../\!:* &'

this is also fine, but I want to handle the case where if multiple filesnames are supplied to ep it would still be able to open them. 这也很好,但是我想处理以下情况:如果为ep提供了多个文件名,则仍然可以打开它们。

Is this possible? 这可能吗?

You can create a function in your .bashrc instead for bash, and whatever the config file for tcsh is as well: 您可以在.bashrc中创建一个代替bash的函数,以及用于tcsh的任何配置文件:

funcname(){
    firstfunc -options etc etc
    secondfunc -options etc etc
}

One thing to consider though, each function will only execute after the previous function has finished, ie secondfunc will do nothing until firstfunc is finished. 不过要考虑的一件事是,每个功能仅在上一个功能完成后才执行,即,在firstfunc完成之前,secondfunc不会执行任何操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM