简体   繁体   English

自定义zsh shell

[英]Customizing a zsh shell

I am trying to modify my terminal by following this tutorial . 我试图通过遵循本教程来修改我的终端。

But I can't seem to copy the batchange.py file to my $PATH , I tried cp batchange.py ~/.bin and everything else I can think of.Here is my $PATH: '/Users/anthonybrown/.rvm/gems/ruby-1.9.3-p125/bin:/Users/anthonybrown/.rvm/gems‌​/ruby-1.9.3-p125@global/bin:/Users/anthonybrown/.rvm/rubies/ruby-1.9.3-p125/bin:/‌​Users/anthonybrown/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11‌​/bin:/usr/local/git/bin' – 但是我似乎无法将batchange.py文件复制到我的$PATH ,我尝试了cp batchange.py ~/.bin和其他我能想到的东西,这是我的$ PATH: '/Users/anthonybrown/.rvm/gems/ruby-1.9.3-p125/bin:/Users/anthonybrown/.rvm/gems‌​/ruby-1.9.3-p125@global/bin:/Users/anthonybrown/.rvm/rubies/ruby-1.9.3-p125/bin:/‌​Users/anthonybrown/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11‌​/bin:/usr/local/git/bin' – cp batchange.py ~/.bin '/Users/anthonybrown/.rvm/gems/ruby-1.9.3-p125/bin:/Users/anthonybrown/.rvm/gems‌​/ruby-1.9.3-p125@global/bin:/Users/anthonybrown/.rvm/rubies/ruby-1.9.3-p125/bin:/‌​Users/anthonybrown/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11‌​/bin:/usr/local/git/bin' –

To add ~/bin to your path: 要将~/bin添加到您的路径:

  1. First, we make the folder (if it isn't already made). 首先,创建文件夹(如果尚未创建)。

     mkdir ~/bin 
  2. Copy batcharge.py into ~/bin : batcharge.py复制到~/bin

     cp batcharge.py ~/bin/batcharge.py 

    (Obviously you'll want to do this from where-ever the batcharge.py script is located). (显然,无论您在batcharge.py脚本所在的位置,都batcharge.py )。

  3. Check if ~/bin is in your path: 检查~/bin是否在您的路径中:

     echo $PATH | grep ~/bin 

    This should come back with a line. 这应该返回一行。 If it does not , we shall add it: 如果没有 ,我们将添加它:

    1. Open ~/.zshrc . 打开~/.zshrc

    2. At the end, add the line: 最后,添加以下行:

       export PATH=$PATH:~/bin 

      This will add ~/bin to your $PATH . 这会将~/bin添加到$PATH

    3. Close the terminal window, and re-open it. 关闭终端窗口,然后重新打开它。 (Or open a new one). (或打开一个新的)。

    4. Type echo $PATH | grep ~/bin 输入echo $PATH | grep ~/bin echo $PATH | grep ~/bin . echo $PATH | grep ~/bin This should now show a line (and you should see ~/bin at the end of the long-ish list of paths). 现在应该显示一行(并且您应该在长路径列表的末尾看到~/bin )。

  4. Now, we test: you should be able to type which batcharge.py and see that zsh knows where to find it. 现在,我们进行测试:您应该能够键入which batcharge.py并看到zsh知道在哪里可以找到它。 For example, type which batcharge.py in terminal, and you should see something like: 例如,在终端中键入which batcharge.py ,您应该看到类似以下内容:

     /Users/simont/bin/batcharge.py 

    Now we can type batcharge.py and see the script run :) 现在我们可以键入batcharge.py并查看脚本运行:)

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

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