RCS Sample Session

In the following session a new shell script is created by someone named user.  User input is shown in bold.  All the steps are shown including setting PATH (both in the current environment and in the login script), making a directory to hold the script, creating and testing the script, creating the RCS repository and checking in the initial version of the script.

Next the script is checked out for editing and some changes are made.  After testing that the script works correctly it is checked in again, this time with an extra option to also check out the new version at the same time.  Then the output of various RCS commands is shown.

[user@YborStudent ~]$ cp .bash_profile bash_profile-old
[user@YborStudent ~]$ vi .bash_profile
[user@YborStudent ~]$ diff bash_profile-old .bash_profile
21a22
> PATH=$PATH:$HOME/bin
[user@YborStudent ~]$ PATH=$PATH:~/bin
[user@YborStudent ~]$ mkdir bin
[user@YborStudent ~]$ cd bin
[user@YborStudent bin]$ vi nusers
[user@YborStudent bin]$ cat nusers
#!/bin/bash
# Simple shell script that reports the number of login sessions.
# Written 2002 by Wayne Pollock, Tampa Florida USA.

NUM=$(who | wc -l)
echo $NUM

[user@YborStudent bin]$ chmod u+x nusers
[user@YborStudent bin]$ nusers
3
[user@YborStudent bin]$ mkdir RCS
[user@YborStudent bin]$ ci -i1.0 nusers
RCS/nusers,v  <--  nusers
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> Script that displays the number of users logged on.
>> .
initial revision: 1.0
done
[user@YborStudent bin]$ co -l nusers
RCS/nusers,v  -->  nusers
revision 1.0 (locked)
done
[user@YborStudent bin]$ vi nusers
[user@YborStudent bin]$ nusers
3
[user@YborStudent bin]$ nusers -v
There are 3 users on the system.
[user@YborStudent bin]$ ci -u nusers
RCS/nusers,v  <--  nusers
new revision: 1.1; previous revision: 1.0
enter log message, terminated with single '.' or end of file:
>> Added $Id$ comment, added "-v" argument for verbose output.
>> .
done
[user@YborStudent bin]$ rlog nusers

RCS file: RCS/nusers,v
Working file: nusers
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;     selected revisions: 2
description:
Script that displays the number of users logged on.
----------------------------
revision 1.1
date: 2003/04/11 22:35:09;  author: user;  state: Exp;  lines: +7 -2
Added $Id$ comment, added "-v" argument for verbose output.
----------------------------
revision 1.0
date: 2003/04/11 22:32:29;  author: user;  state: Exp;
Initial revision
=============================================================================
[user@YborStudent bin]$ rcsdiff -r1.0 nusers
===================================================================
RCS file: RCS/nusers,v
retrieving revision 1.0
diff -r1.0 nusers
2c2
<
---
> # $Id: nusers,v 1.1 2003/04/11 22:35:09 user Exp $
6c6,11
< echo $NUM
---
> if test "$1" = "-"
> then
>     echo There are $NUM users on the system.
> else
>     echo $NUM
> fi
[user@YborStudent bin]$ ls -l nusers
-r-xr--r--    1 user user      206 Apr 11 18:35 nusers
[user@YborStudent bin]$ cat nusers
#!/bin/bash
# $Id: nusers,v 1.1 2003/04/11 22:35:09 user Exp $
# Written by Wayne Pollock

NUM=$(who | wc -l)
if test "$1" = "-v"
then
    echo There are $NUM users on the system.
else
    echo $NUM
fi
[user@YborStudent bin]$