I'm trying to add a license header to all header files and source files in a project directory using a for loop. This is not working, is there any other approach using sed?
|
|
|||||
|
|
|||||||
|
|
This is more or less just an extended commentary on Daniel Serodio'` answer. I started writitng it as a comment, but it quickly grew too large... For a bash glob to be recursive, it requires To avoid processing a directory such as You can also consider the possibility of there being no matching files by using To handle multiple patterns, you can chain the glob patterns: If you want To safely handle modifying a file which is being piped, use
|
|||||||||
|
|
Thank you @fred, @maxmackie, @enzotib. Can you please check the procedure I have followed.
otherwise the license header will be copied to multiple number of times. Please suggest me a pattern to go through all the headers and sources in project directory and subdirectories. I could not understand fully what @fred has suggested. |
|||||||||||
|
|
You can do this with
|
||||
|
|
