All pastes #623406 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-17 15:45 UTC
rendered paste body
#!/bin/sh

## The directory passed in from the command line.
## We have to be in the directory of the directories in question
DIR=$1
echo "You entered: $DIR"

## Assign a start for our counting integer
i=0

## Do a loop until we find a free number
LOOPDIR=$DIR
while [ -d $LOOPDIR ]
do
        ## Give it a name
        LOOPDIR=$DIR$i

        ## Add 1 to it each time through
        i=`expr $i + 1`
done


echo "It appears as: $LOOPDIR is available"
echo "Making directory $LOOPDIR:"
mkdir $LOOPDIR

## Add copy stuff here. I.E.
## cp $DIR.ss1 $LOOPDIR/$DIR.ss1

exit;