MLUG: Re: [MLUG] VMS file version numbering for unix?
Re: [MLUG] VMS file version numbering for unix?
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
is plain ol' RCS an option? I have a real simple shell script that makes 
using it a breeze. Don't remember where I got it, but it'll check the 
files in and out, creating the RCS directory underneath without much 
interaction required...

Rick

rcs_script:
#!/bin/sh
#
# rvi -- edit RCS maintained file
#        usage: rvi file1 [file2] [file3] ...
#
#       Pseudo-interactively does RCS handling for config files
#

CI="ci -zLT"
CO="co -zLT"

name=`basename $0`

for file in $*; do
     dir=`dirname $file`
     base=`basename $file`
     user=`ls -l $file | awk '{print $3}'`
     group=`ls -lg $file | awk '{print $4}'`

     if [ -f $file -a ! -h $file ]; then
         if [ ! -d $dir/RCS ]; then
             echo -n "$name: No RCS directory! Create one? (y/n) [y] "
             read yn
             if [ X$yn = Xn ]; then
	        echo $name: Aborting.
	        exit
             fi
             mkdir $dir/RCS
         fi
         if [ ! -f $dir/RCS/${base},v ]; then
	    echo -n "$name: \"$file\" not checked in! Check it in? (y/n) [y] "
             read yn
             if [ X$yn = Xn ]; then
                 echo $name: Aborting.	
                 exit
             fi
             $CI -u $file < /dev/null
         fi
         $CO -l $file && ${EDITOR-vi} $file && $CI -u $file
         chown ${user}.$group $file > /dev/null 2>&1
     else
	echo $name: \"$file\" is a symlink/is a directory/does not exist!
     fi
done

Mike Miller wrote:

> Some users of the VMS operating system are very fond of the way VMS will
> not overwrite a file but will tack a ";n" (where n is an integer) at the
> end of the filename.  So if I were to edit a file four times, and the
> original file was called file.txt, I'd end up with these files:
>
> file.txt;1
> file.txt;2
> file.txt;3
> file.txt;4
> file.txt;5
>
> Of these, file.txt;5 would be the oldest (the original file.txt) and
> file.txt;1 would be the newest.  Has this been implemented in any unix OS
> or unix shell?
>
> I could make it work for certain programs.  Emacs already does this sort
> of thing, if you ask it to.  But I'm not so sure it's possible to find a
> unix OS (or shell) that will do this for all programs that might overwrite
> a file.  VMS implements a PURGE command to allow the user to delete the
> old versions.
>
> Mike

--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/