Checking a file for its directory

From: Robert K (unixrobert@yahoo.ca)
Date: Tue Jun 27 2006 - 15:12:42 EDT


Hello Managers
  I am writing a script to delete logfiles. The script will be called at the command line followed by the log file name as the argument. Right now I am working for <./scriptname> <filename>. I have added couple of "if-then-*-fi"s
  to check for root access and the sake of one file name as the command line argument. Now I also want to add one more loop which will be perforfmed after the above mentioned loops that checks whether the file is under the LOG_DIR (This is a declared variable at the begining of the script) or not?
   
  Basically I want the command or syntax for this.
   
  if [[ "$1" <is not under> "$LOG-DIR" ]]
  then
  echo "The file $1 is not under $LOG_DIR ]]
  else
  rm $1
  fi
   
  Thanks and I will summarize

                 
---------------------------------
 All new Yahoo! Mail -
---------------------------------
Get a sneak peak at messages with a handy reading pane.
_______________________________________________
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:40:16 EDT