pyt*_*hon 5 macos bash shell .bash-profile
我已经在我的别名中定义了三个别名,.bash_profile但是我的bash shell没有读取它。定义的别名在我的终端中不起作用,并且我无法解决此问题。
alias handybook="cd /Users/rsukla/development/repos/handybook/"
Run Code Online (Sandbox Code Playgroud)
此行是在中定义的,.bash_profile但在我的shell中不起作用。
到目前为止我尝试过的事情:
我已经创建了.bashrc文件并定义了别名,但它也无法正常工作。
如果使用source ~rsukla/.bash_profile了别名,则别名工作正常,但我希望永久使用别名,因此不必source每次打开外壳时都使用别名
知道为什么在alias定义时为什么不工作.bash_profile吗?
我们仍然不知道为什么别名没有自动加载。
您的别名应该从.bash_profile. 这是 OS X 中 bash 的默认行为。
mklement0在这个线程的回答中写了更多关于这个问题的信息。
打开终端的首选项。您指定启动 shell 的命令:
您可以在 shell 打开时指定要获取的文件,而不是每次都手动获取点文件。以下是 的选项列表bash:
Usage: bash [GNU long option] [option] ...
bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
--wordexp
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
Run Code Online (Sandbox Code Playgroud)
您可能会考虑使用/bin/bash --rcfile alias_file_of_yours或类似的东西。
goat如果您需要使用该命令的别名,请选择cd。作为旁注,我确实建议您查看goat。它可以让您cd轻松管理此类别名。
我用它,我写它。
| 归档时间: |
|
| 查看次数: |
3453 次 |
| 最近记录: |