Mac: Alias[設置命令的別名]


設置`.bash_profile`

1.打開終端`Terminal`

2.輸入命令`cd ~`到用戶主目錄

$ cd ~

3.生成一個新文件

$ touch .bash_profile

4.使用喜歡的方式編輯`.bash_profile`文件,也可以使用`-e`參數,使用`TextEdit`打開文件

$ open -e .bash_profile

 5.更新內建命令

$ source .bash_profile 

向`.bash_profile`中增加命令別名

alias restart_network=/Users/mac/.command/RestartNetwork.sh

重啟網絡

#!/bin/sh

sudo ifconfig en0 down
sudo ifconfig en0 up
//RestartNetwork.sh 中的內容

 參考:

  • http://blog.marslightstudio.com/?p=122
  • http://witcheryne.iteye.com/blog/1683484
  • http://baike.baidu.com/subview/49616/5092575.htm?fr=aladdin


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM