简体   繁体   English

bash:更改文件夹中所有头文件的扩展名

[英]bash: Changing extension of all the header files in a folder

I want to create symbolic links that point to all the header files in my folder. 我想创建指向我的文件夹中的所有头文件的符号链接。

For example, 例如,

ln -s ctype.h ctype.SUNWCCh

The name of the symlinks should be the same, except that they have the "SUNWCCh" extension. 符号链接的名称应该相同,只是它们具有“SUNWCCh”扩展名。 Also, there are many header files so I would like to do it recursively. 此外,有许多头文件,所以我想递归地做。 Any suggestions? 有什么建议么?

Thanks in advance! 提前致谢!

Try this using pure : 尝试使用纯

shopt -s globstar

for i in **/*.h; do
    ln -s "$i" "${i%.h}.SUNWCCh"
done

Since bash4, ** stands for recursive if you enable it with shopt -s globstar 从bash4开始,如果你用shopt -s globstar启用它, **代表递归

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM