Checking a file for its directory
- From: Robert K <unixrobert@xxxxxxxx>
- Date: Tue, 27 Jun 2006 15:12:42 -0400 (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@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
- Prev by Date: How to play embedded <embed> wavs in Mozilla / Solaris 10?
- Next by Date: Networking in solaris x86
- Previous by thread: How to play embedded <embed> wavs in Mozilla / Solaris 10?
- Next by thread: Networking in solaris x86
- Index(es):
Relevant Pages
|
|