Script help needed

From: Polachak, Jason M CTR NAVSEA (jason.polachak.ctr@navy.mil)
Date: Wed Aug 10 2005 - 19:30:10 EDT


All,
  I am currently writing a script to automate some of my job. In the
beginning of this script I look to see if a directory is present. If it
is not present then it will make it. If it is not present then it will
make a directory with the output of the hostname command attached to the
end of the directory.
The problem is later in the script I will then need to place the files
I created into these directories. How do I get the script to know which
directory to place them in. The two functions I am concerned about
right now are the MAKE and DIRCHK My DIRCHK function is just a guess of
mine however it doesnt work. Any help would be greatly appreciated.

Thanks,
  Jason

#/bin/sh
#set -x

ACC=/accredit
HOST=`hostname`
DIR=/accredit

MAKE () {
cd /
ls | grep accredit
        if [ "$?" != "0" ] ; then
          mkdir $DIR
        else
          mkdir /${DIR}${HOST}
        fi
}

MAKE

DIRCHK () {
cd /
ls /admin
  if [ "$?" = "0" ]
      then exit
    else
      exit 1
  fi
}

[demime 1.01b removed an attachment of type application/x-pkcs7-signature which had a name of smime.p7s]
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:31:17 EDT