写个函数在家目录的 。bashrc, 如是
#function: lcd , change dir and display content of dir
lcd ()
{ local ret
cd "$*"; ret=$?
[ $ret -eq 0 ] && ls -hF --color=tty
}
存档后执行 source ~/。
bashrc
以后用 lcd 这个命令就等如
cd 目录
ls
例如:
User@User-PC ~
$ type lcd
lcd is a function
lcd ()
{
local ret
cd "$*"; $ret=$?
[ $ret -eq 0 ] && ls -hF --color=tty
}
User@User-PC ~
$ pwd
/home/User
User@User-PC ~
$ lcd bin
astock。
sh* fqn* getproxy。pl* max_memory。c rot13。bash* tetris。sh*
awksrc free* getproxy。sh* max_memory。exe* rot13。rb* tree*
bwhois* free。
ash* hellogui。c myip* rot13。sed* tvbprograme。pl*
cap* free。awk* hklib* mystock。sh* rot13。sh* tvbprograme。sh*
cap。
ash* free。rb* ldd* num。sed* rot13。tcl* weather。sh*
cfaj_stock* free。sh* lotto* pass* stock* weather7days*
commas。
sh funfacts* marksix* rev* stripoff* webproxy*
count* funfacts。pl* marksix。awk* rev。ash* swapcase* whereis。sh*
dict。
pl* getproxy。awk* marksix。pl* rot13。ash* swapcase。
ash* zcalc*
User@User-PC ~/bin
$ pwd
/home/User/bin
User@User-PC ~/bin
$
呵呵,这可解决了吗?。
全部