Mac下沒有Linux下的tree
命令,但是今天找到一個非常牛逼的一條指令可以模擬tree
命令的功能:
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
你可以將他添加到你的.bash_profile
文件下:
echo "alias tree=\"find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'\"" >> ~/.bash_profile && source ~/.bash_profile
這樣你可以在你的Mac終端下是用tree
命令實現(xiàn)類似的效果雾袱。
效果圖:
目前不太清楚這里面涉及到的正則表達(dá)式機(jī)制鹿鳖。先占個坑柄冲,等有空好好分析一下。