Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 使别名在子shell-UNIX中可用_Bash_Unix_Alias - Fatal编程技术网

Bash 使别名在子shell-UNIX中可用

Bash 使别名在子shell-UNIX中可用,bash,unix,alias,Bash,Unix,Alias,如何生成中列出的所有别名 ~/.别名 是否在所有子壳中都可用?我是unix新手,所以对此不太了解 谢谢在您的主目录中需要一个.bashrc文件,您可能有一个。为每个别名添加一行,如下所示: alias[space]myalias[nospaceshere!]=[nospaceshere]'/path/to/command arg1 arg2 ' 例如: alias ll='ls -l ' 如果您觉得可以在别名的使用过程中避免出现问题,可以添加一个尾随空格。在Ubuntu中,您可以使用~/.b

如何生成中列出的所有别名 ~/.别名 是否在所有子壳中都可用?我是unix新手,所以对此不太了解


谢谢

在您的主目录中需要一个
.bashrc
文件,您可能有一个。为每个别名添加一行,如下所示:

alias[space]myalias[nospaceshere!]=[nospaceshere]'/path/to/command arg1 arg2 '
例如:

alias ll='ls -l '

如果您觉得可以在别名的使用过程中避免出现问题,可以添加一个尾随空格。

在Ubuntu中,您可以使用~/.bash\u别名编写:

.~/。别名


每次打开新终端时,都会定义别名。

希望此链接中的响应有帮助:无论如何,您应该更喜欢函数而不是别名。与别名相比,函数还有许多其他优点,其中之一是可以导出函数,即子流程继承函数。