Search This Blog

Saturday, June 30, 2007

A simple bash script to change a file name

The following script will replace "mydata.dat" by "my22data.dat".


#!/bin/bash
mv mydata.dat my$1data.dat

If the script name is "changefile", type and enter in a shell prompt:

changefile 22

22 is the argument ($) taken as $1, and 1 means the first argument. In this case, there is only one argument.

Friday, June 29, 2007

Negative Index of Array Dimension

REAL, DIMENSION(-5:5) :: Z

DO i=-5,5
Z(i) = REAL(i)
WRITE(*,*) i, Z(i)
END DO

STOP
END

Generation of Files with Sequential Names

CHARACTER (40) :: Fname='Move',str
INTEGER :: i,imax=1000000
INTEGER :: r,s

DO i = 1,10

WRITE(str,'(F7.6)') REAL(i)/REAL(imax)
r=scan(str,".")
s=len(str)
str=str(r+1:s)

WRITE(str,*) TRIM(Fname)//TRIM(str)//".dat"

OPEN(unit=imax+1,file=str)
WRITE(imax+1,*) TRIM(str)
CLOSE(unit=imax+1)

END DO

STOP
END

Friday, June 22, 2007

How to create SVN repository

I create my own svn repository under my home directory of my Ubuntu Linux box using the following command.

svnadmin create --fs-type fsfs /home/albertsk/svn2/albertsk

kdesvn provides a wonderful GUI environment with users to easily manage svn repositories.

Good svn tutorials can be found at

http://artis.imag.fr/~Xavier.Decoret/resources/svn/
http://svnbook.red-bean.com/

Labels

Bacteria

Loading...