将许可证头添加到源文件的工具? [英] Tool for adding license headers to source files?
本文介绍了将许可证头添加到源文件的工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种工具,可以批量向某些源文件添加许可证头,其中一些源文件已经有了头.是否有一个工具可以插入一个标题,如果它不存在的话?
I'm looking for a tool that will, in bulk, add a license header to some source files, some of which already have the header. Is there a tool out there that will insert a header, if it is not already present?
我故意不标记这个问题的答案,因为答案基本上都是特定于环境和主观的
推荐答案
#!/bin/bash
for i in *.cc # or whatever other pattern...
do
if ! grep -q Copyright $i
then
cat copyright.txt $i >$i.new && mv $i.new $i
fi
done
这篇关于将许可证头添加到源文件的工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文