linux 打印当前所在目录,并展示当前内目录列表

来源:互联网 发布:矢量量化算法 编辑:程序博客网 时间:2024/05/13 15:55
在个人的HOME目录内新建一下BIN文件夹,创建一个PL文件<div>写入</div><div><div>pwd</div><div>echo -e "\n"</div><div>ls $1 $2</div></div><div></div><div>保存后 </div><div>chmod +x pl</div><div>编辑.bashrc文件</div><div>添加</div><div>export PATH="$PATH:/home/sky/bin/"</div><div>保存退出,再登陆,个人的环境变量就生效了</div><div>这样就可以用pl了</div><div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);">sky@sky-To-be-filled-by-O-E-M:~/server$ pl</div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);">/home/sky/server</div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);"></div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);"></div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);">memcached  <wbr>nginx  <wbr>php</wbr></wbr></div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);"></div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);"></div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);"></div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);">进入目录并展示目录结构 cl</div><div style="color: rgb(70, 70, 70); font-family: simsun; font-size: 14px; line-height: 21px; background-color: rgb(188, 211, 229);"><div>cd $1</div><div>pwd</div><div>echo -e "\n" <wbr></wbr></div><div>ls <wbr></wbr></div><div></div><div>注意执行CL的时候,需要加上SOURCE,当前的目录路径不会变的,因为执行SHELL的时候,会创建一个子SHELL,切换目录的变量执行完就没有了,在当前的SHELL内没有得到切换后的路径</div><div></div></div></div>
0 0
原创粉丝点击