Version Control Through the Shell Script


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Version Control Through the Shell Script
# 1  
Version Control Through the Shell Script

Version Control Through the Shell Script

Hi Guys,
Apologize for the big request, please take some time and read it completely... This is Very important for me, and ur help is Very much Appriciated.

I want to maintain the Version control to all my scripts running in Production server, I am not allowed to use any tool like Perforce,clearcase, etc... So thought to write the script for it, which manages the Version control to my scripts which are changing everytim,

Here is the brief about my plan about it, please suggest how can I implement it, or also if there is another way to do it through script,that will be v helpful...

I have around 100 scripts under one folder, for example /home/Anji
I am planning to create one more folder under it namely Versions, like /home/Anji/Versions.
and copy all the 100 scripts under the versions folder without any content in it(Blank Scripts) with VC extension[To understand this is a VersionContraol file for the script]

For Ex:
One of my script under /home/Anji is batch_Trades.sh, which contaned 1000 lines of code,which will be changed when ever there is a request from users...

I will create the same script name batch_Trades.sh_VC /home/Anji/Versions folder...


So Everytime when I change the original script batch_Trades.sh I want to record the Version control in batch_Trades.sh_VC file in below manner,

####################################################
Version: 1.0
Script Name:
CR Number:
Date:
Reason for changing the script:
Change Implementer:
####################################################

For the first We need to define the pattern, and from 2nd time onwords,Version must be change dynamically [may be we can get the version id from previous version and do +1 to that) For all the other fields in the pattern, we need to give them from the command line when we run the script like below..

$./Version.sh batch_Trades.sh [Below is the command output script needs to ask when we run]
Do you want to continue (y/n) : y
What is the Script Name: batch_Trades.sh
What is the CR Number: 12345
What is Change Date: 02-11-2010
Reason for changing the script: Businmess Requst
Who is the Change Implementer: Anji
Finished Script....
$

Once all the Information is Given then, automatically this information should append to the VC file which is under /Home/Anji/Versions folder, i.e., batch_Trades.sh_VC

This is little bit big mail.... but i just wnated to give the full details to understand better.

Thanks In Advance Guys
# 2  
There is an inbuilt version control facility available in UNIX. You can manage your versions using SCCS facility of UNIX. Go through man pages of SCCS or contact your system administrator for more information.

I use this approach in following way.

PHP Code:
# SCCS information:
# %Z%        File: %M%
# %Z%     Version: %I%
# %Z%   SCCS Base: %F%
# %Z%  Updated on: %E% at %U%
# %Z% Obtained on: %D% at %T%
#
# Name:  
#     Program Name
#
# Purpose:
#     Purpose of the code. 
#
# Description:
#     Description.
#
# Author:
#     James Bond
#
# History:
#     01-Jun-2009 Mon   James Bond
#             First version checked in. 
Whenever changes are made, coder simply appends his/her name under History tag along with the changes. Rest are automatically updated by SCCS itself.
R0H0N
# 3  
Thanks ROHON for the reply..
I found the usage and the use of this SCCS facility, But dint find more about how Can I use this in my scenario..
Can you please let me know How can I use it?
# 4  
On top of the every script you can introduce these lines and SCCS will automatically track the version information.

so your script will look like:
PHP Code:
# SCCS information:
# %Z%        File: %M%
# %Z%     Version: %I%
# %Z%   SCCS Base: %F%
# %Z%  Updated on: %E% at %U%
# %Z% Obtained on: %D% at %T%
#
# Name:  
#     Program Name
#
# Purpose:
#     Purpose of the code. 
#
# Description:
#     Description.
#
# Author:
#     James Bond
#
# History:
#     01-Jun-2009 Mon   James Bond
#             First version checked in.

code line 1
code line 2
code line 3
code line 4
code line 5
code line 6 
now if changes required after line 4 then
PHP Code:
# SCCS information:
# %Z%        File: %M%
# %Z%     Version: %I%
# %Z%   SCCS Base: %F%
# %Z%  Updated on: %E% at %U%
# %Z% Obtained on: %D% at %T%
#
# Name:  
#     Program Name
#
# Purpose:
#     Purpose of the code. 
#
# Description:
#     Description.
#
# Author:
#     James Bond
#
# History:
#     01-Jun-2009 Mon   James Bond
#             First version checked in.
#     01-Jan-2010 Wed   Bond James
#             Changes done.
  
code line 1
code line 2
code line 3
code line 4
code changed
code line 5
code line 6 

R0H0N
# 5  
Thanks Rohon...
I tried as you suggested for one of my script for testing, but i dont see any changes in script? Where will be this Version information can see in?
Is there any other file will generate with the version information or In the same script it will update the version?
Please help
# 6  
Did u explore how to create a new SCCS file? Please read some books and get some knowledge on it first. Please refer Sumitabha Das books on Unix. This topic is very well explained in it.
R0H0N
# 7  
Hi.

Observations:

I agree with R0H0N: you need to do some reading and experimenting. This subject is complex, too complex to address in a q/a session like a forum.

I have been involved in version-control (source-code-control) for a long time, dating back to the mainframe era.

From my perspective, the movement along systems (with most emphasis on *nix) has been:
Code:
(MF) cosy/etc ->  (*nix) sccs -> rcs -> cvs -> subversion -> bazaar -> mercurial

You can see some of these at Comparison of revision control software - Wikipedia, the free encyclopedia

The sccs system was one of the first, and is now considered by many to be obsolete. If you are looking for something that is simple and local, I'd suggest RCS.

If you are looking for client-server (repository may be on a network node), or distributed, see the later systems.

For a very simple system, you might be interested in Amazon.com: Unix Programming Environment (Prentice-Hall Software Series) (9780139376818): Brian W. Kernighan, Rob Pike: Books wherein a short set of scripts is developed that will do source control. The book addresses many other topics. Lest you think this is too old, note that, while the publication date is 1984, it is still in print and available.

Good luck ... cheers, drl
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #374
Difficulty: Easy
In 2004, a new edition of the POSIX:2002 standard was released called POSIX:2004 (formally: IEEE Std 1003.1-2004).
True or False?

9 More Discussions You Might Find Interesting

1. Programming

Version control for audit

Hi.I am running some scripts from a "scripts" directory for my job (I am working in Financial industry).For compliance purposes I need to use a "release" directory when running them using some sort of version control(CVS,SVN or GIT) in case the program is audited.Basically I have to maintain a dev... (0 Replies)
Discussion started by: rolleikid
0 Replies

2. Shell Programming and Scripting

Control - M Scheduler is not able to pick my shell script

Hi, Below is a shell script that i made:- #!/bin/ksh #path=/opt/tibco/shared/adaptadores/SSCC/EVEREST/input/ if ; then echo "ZIP Exists and now Processing" for files in /opt/tibco/shared/adaptadores/SSCC/EVEREST/input/T010B04.* do unzip $files echo "Files Unzipped" echo $files... (4 Replies)
Discussion started by: mmtrexon
4 Replies

3. Post Here to Contact Site Administrators and Moderators

Control - M Scheduler is not able to pick my shell script

Hi, Below is a shell script that i made:- #!/bin/ksh #path=/opt/tibco/shared/adaptadores/SSCC/EVEREST/input/ if ; then echo "ZIP Exists and now Processing" for files in /opt/tibco/shared/adaptadores/SSCC/EVEREST/input/T010B04.* do unzip $files echo "Files Unzipped" echo $files... (1 Reply)
Discussion started by: mmtrexon
1 Replies

4. UNIX for Dummies Questions & Answers

Simple version control script for text files

HI guys, Could you help me writing a simple version control script for a text files. the format could be ./version_control <file(s)> (I want it to be able to work with more than 1 file at the same time) commands are add and get, add means you add new file(s) to the archive, get means you... (4 Replies)
Discussion started by: s3270226
4 Replies

5. Shell Programming and Scripting

Control browser from shell script

I have a browser running in a separate virtual terminal and would like to be able to send shortcut codes (e.g. ctrl+A) to the browser (and have it react) from a bash script in a separate virtual terminal. I need to keep the script in the separate virtual terminal. (2 Replies)
Discussion started by: slak0
2 Replies

6. Shell Programming and Scripting

how to disable and enable <control>-c or -z in a shell script

Dear all, good day. i'm asking about how to disable <control>-c or <control>-z in the beginning of a shell script then enable it again before the script exit Best Regards ---------- Post updated at 04:41 AM ---------- Previous update was at 04:18 AM ---------- Dear All i found the... (3 Replies)
Discussion started by: islam.said
3 Replies

7. Shell Programming and Scripting

How to Control Cronjobs using Shell Script??

Hi All, Now i am running the 3 oracle procedures one by one manually. Query: If 1st Procedure OUT_PUT is Success, then call 2nd Procedure. If 2nd Procedure OUT_PUT is Success, then call 3rd Procedure. If 1st Procedure is failed, then no need of calling the other ... (8 Replies)
Discussion started by: hanu_oracle
8 Replies

8. Shell Programming and Scripting

control over shell script

Hi.. I have a perl program that uses "system" to execute a shell script called startengine. The script "startengine" itself calls a lot of other smaller scripts to setup the engine etc. It finally has to execute ./engine which is another shell script which is long and takes a long time to... (3 Replies)
Discussion started by: JLJ
3 Replies

9. UNIX for Dummies Questions & Answers

Version Control

I am not sure if this is the right forum to post my question on Version Control. Anyway, here it is! I use CVS for source code maintainence in my Solaris box. Is there any command where I can find out in CVS, if any check-in/check-out was done in the last 24 hours? I need a listing of all the... (3 Replies)
Discussion started by: Deepa
3 Replies

Featured Tech Videos