簡體   English   中英

如何為`cd`寫一個bash別名,它也`ls`目錄內容?

[英]How to write a bash alias for `cd` that also `ls` the directories contents after?

基本上,如何進行這兩個步驟:

$:/ cd Users
$:/Users ls
user1 user2 user3

一步過程:

$/ cd Users
$:/Users
user1 user2 user3

bash腳本的偽代碼可能是:

after changing directories, pause the input state and take another command
command('ls')

編輯 這是一個很棒的bash參考-http://cb.vu/unixtoolbox.xhtml#scripting

編輯2 http://bhami.com/rosetta.html

edit-3 什么是特殊的美元符號外殼變量?

alias mycd='cd $(history 1 | sed "s/.*mycd \(.*\)/\1/") && ls #'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM