Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sccs delget error for setting DATE --> (%Y%)

Status
Not open for further replies.

rhombheng

Programmer
May 12, 2002
4
PH
In my script, I used this setting:

setenv DATE `date '+%Y%m%d'`

to make $DATE equal to yyyymmdd format.

But whenever I "sccs delget" the script, that line changes to

setenv DATE `date '+m%d'`

The "%Y%" disappears.....

Can anyone help me retain the original setting for DATE?

Is this an sccs bug?

Thanks!

 
No bug ... %Y% is an SCCS keyword which it uses to update header information, etc. In our shell scripts, the 1st line is always

# %W% %G%

which gets converted to

# @(#)script_name 1.1 05/20/02

when checked in to SCCS

If you want to use date formatting commands in a script which is managed through SCCS, you need to "escape" the format commands. I don't know all the SCCS keywords, so I'll escape them all. Try this, which should work OK.

setenv DATE `date +%\Y%\m%\d`

Note that you don't need the single quotes round the date format string.

Greg.
 

I tried the escape format and it worked.
Thanks, grega!
 
sccs variables are all in the form %X% where X can be any number of UPPERCASE letters (this is not the place for a discussion in the workings of sccs, for more detail read man sccs).

So only the Uppercase date formatting variables that are followed by another variable need the escaping. If you have the year at the end (i.e. date +%m%d%Y) sccs will not touch your format string.

Hope this helps, Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top