Background
The shell script creates several Java source files. The source files have a special comment for the header, which includes Subversion keywords. The goal is to check the shell of the script without changing the headers of the source files buried inside.
Problem
The shell script contains its own header, which should have a keyword extension:
#!/bin/bash
This part works. Invalid part when comment is included later in shell script:
cat <<EOT >> $FILENAME_IMPL
/*
* *********************************************************************
* Revision Control Information
* File: $Id:: $
* Date of Last Commit: $Date:: $
* Revision Number: $Rev:: $
* Last Commit by: $Author:: $
*
* **********************************************************************
*/
package com.company.pkg;
EOT
script , ; Java . , , . .
, Java:
cat <<EOT >> $FILENAME_IMPL
/*
* *********************************************************************
* Revision Control Information
* File: $Id:: autogenerate.sh $
* Date of Last Commit: $Date:: 2016-08-26 11:50:21 -0700 (Fri, 26 Aug 2016) $
* Revision Number: $Rev:: 1234 $
* Last Commit by: $Author:: USERNAME $
*
* **********************************************************************
*/
package com.company.pkg;
EOT
Java "autogenerate.sh", "ClassName.java".
, script, autogenerate.sh:
#!/bin/bash
FILENAME_IMPL=ClassName.java
cat <<EOT >> $FILENAME_IMPL
/* File: $Id:: $
*/
package com.company.pkg;
EOT
script , :
#!/bin/bash
FILENAME_IMPL=ClassName.java
cat <<EOT >> $FILENAME_IMPL
/* File: $Id:: autogenerate.sh $
*/
package com.company.pkg;
EOT
$Id:: . $Id:: . , script , :
#!/bin/bash
FILENAME_IMPL=ClassName.java
cat <<EOT >> $FILENAME_IMPL
/* File: $Id:: $
*/
package com.company.pkg;
EOT
. :
cat <<EOT >> $FILENAME_IMPL
/* File: \$Id:: $
*/
package com.company.pkg;
EOT
, , Subversion?