取消隐藏UNIX隐藏文件使用sed和mv命令 [英] unhide hidden files in unix with sed and mv commands
本文介绍了取消隐藏UNIX隐藏文件使用sed和mv命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道是否ü可以帮助我固定bash脚本应取消隐藏目录中的所有文件隐伏。
哪里有问题?
参数='。
在$参数*文件;做
MV $文件$(回声$文件| sed的'S / ^ \\(* \\)/ \\ 1 /')
DONE
出口
解决方案
本循环
应该工作:
出口GLOBIGNORE =:..
在文件*。做
MV -n$文件$ {#文件}
#MV -n$文件$ {文件:1}
DONE
PS:更好地备份你的文件做了大规模的MV前/重命名
i wonder if u could help me with fixing bash script which should unhide all hiden files in dir. Where is the problem?
param='.'
for file in $param*; do
mv $file $(echo $file | sed 's/^.\(.*\)/\1/')
done
exit
解决方案
This for loop
should work:
export GLOBIGNORE=".:.."
for file in .*; do
mv -n "$file" "${file#.}"
# mv -n "$file" "${file:1}"
done
PS: Better to backup your files before doing a mass mv/rename
这篇关于取消隐藏UNIX隐藏文件使用sed和mv命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文