蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年6月26日 11:18


about upper case file name to low case , Thanks

Hi Dear Dxs,
Chinese input was damaged, sorry

a one line script , to change upper case files name to low case
files name, can't run correctly:
in current dir:
ls | xargs mv  $1 `echo $1| tr '[A-Z]' '[a-z]'`,

it is asked to use "xargs", do't use the below:
for i in "dir";
do mv $i  `echo $1| tr '[A-Z]' '[a-z]'`



Any help,

Thanks  a lot,

about upper case file name to low case , Thanks

mymv.sh:
=============

mv $1 `echo $1 | tr '[A-Z]' '[a-z]'`

=============

cmd :
chmod 755 mymv.sh

ls | xargs ./mymv.sh
=============

about upper case file name to low case , Thanks

sorry, it does not work .

about upper case file name to low case , Thanks

这样如何?BTW:觉得楼主的例子不适合用xargs.
[code]ls -1|grep '[A-Z]'|xargs sh -c 'for i;do mv $i `echo $i|tr A-Z a-z`;done' null[/code]

about upper case file name to low case , Thanks

不用循环的话,只用xargs很难实现楼主的要求。



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com