[Sccs-devel] SCCS keyword expansion issue
The UNIX Source Code Control System activelty maintained/enhanced
Brought to you by:
schily
From: thinkunix <thi...@zo...> - 2018-08-01 23:43:18
|
Hi, I have been using Schily SCCS for a while and it has worked great. Recently I ran into an issue with ID keyword expansion. I have a shell script which is setting a variable using the date(1) format controls, like so: ....................cut here.................... : # datestring.sh #ident %W% %E% %U% %Q% # DATE=`date +%Y%m%d-%H%M%S` echo "DATE = [$DATE]" ....................cut here.................... I check it into SCCS then check out a read-only copy which will have the ID keywords expanded using the following sequence: $ admin -idatestring.sh -y'initial version' s.datestring.sh $ rm datestring.sh $ get s.datestring.sh 1.1 7 lines The problem is the multiple '%' chars in the date(1) command are being expanded as though they were SCCS ID keywords. Obviously, this breaks the shell script. $ cat datestring.sh ....................cut here.................... : # datestring.sh #ident @(#)datestring.sh 1.1 18/08/01 19:13:22 # DATE=`date +m%d-08/01/18M%S` echo "DATE = [$DATE]" $ sh ./datestring.sh DATE = [m01-08/01/18M35] ....................cut here.................... Historically date(1) lacked format strings, e.g. "+%Y%m%d", so this was never an issue. I tried "get -k" but that prevents expanding _ALL_ SCCS ID keywords, and I do want them for revision identification. I am running Slackware 14.2 on x86 with SCCS version: admin schily-SCCS version 5.05 2011/10/01 (i686-pc-linux-gnu) I also tried: admin schily-SCCS version 5.08 2015/09/05 (i686-pc-linux-gnu) with the same results. Any suggestions on how to work around this? I could call date(1) multiple times and build up the date string but that seems wasteful. Something like this: YEAR=`date +%Y` MONTH=`date +%m` DAY=`date +%d` ... TODAY="$YEAR$MONTH$DAY..." thanks, scot |