[英]Script to list all files each time I change directory for bashrc?
I would like to list all files each time I execute the "change directory" command. 我想在每次执行“更改目录”命令时列出所有文件。
I have already tried adding this to my ~/.bashrc: 我已经尝试将其添加到我的〜/ .bashrc中:
function cdl { cd $1; ls;}
and running this in terminal: 并在终端中运行它:
cdl directorytoswitchto
Long story short: I would like to do cd
and ls
in the same command. 长话短说:我想在同一命令中执行
cd
和ls
。
To override a builtin function with a different version, you typically will call the original via command
. 要使用其他版本覆盖内置函数,通常会通过
command
调用原始函数。 For example, 例如,
cd() { command cd "$@" && ls; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.