Checking a file for its directory



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



Relevant Pages

  • Re: telnet/ssh disconnects... Possible NAT teardown?
    ... I'm not familiar enough with tcpdump's syntax to know what to ... What command line options should I use? ... I'm not sure, I'm at a remote location at the moment, so I have no way of ... Do you Yahoo!? ...
    (Fedora)
  • Re: Accesing structures data (getting lengthy!)
    ... According to the syntax you ... assignment statement just won't stand out amongst all the other ... meaningless dummy variables that you have to keep track of. ... comparitively easy to pick out of a long, boring, command line history, ...
    (comp.soft-sys.matlab)
  • Re: Windows could not upgrade the file..........Security update KB
    ... "Sky King" wrote in message ... > Robert Aldwinckle wrote: ... I would not have offered my tip about copying text from a command ... probably over a simple syntax error. ...
    (microsoft.public.windowsupdate)
  • Re: krb5kdc_err_s_principal_unknown on Windows Kerberos Domain
    ... command line with the parameter "tickets". ... fail group policy replication for users. ... I went to the command line and tested this unusual syntax, ...
    (comp.protocols.kerberos)
  • Re: coding a command button to change properties on another form
    ... Try placing your disable code in the Form2 OnOpen event. ... OpenArgs string is passed to Form2, so that Form2 can examine and act/notact upon it. ... the syntax for the FormOpen method is wrong... ... On this command button that has a macro, ...
    (microsoft.public.access.formscoding)