how to reterive a file from specific path using unix script
prasanna ganesh
Greenhorn
Joined: Jul 04, 2011
Posts: 9
posted
0
Hi,
I want to take a file from specific path using unix shell script.
The file which i want, should take the file from the location given by using the following command in unix "$ls -ltr | tail -1". That is it should take the latest file in that path.
Below is my script. I can able to view the list of files in the path but i need to take the file into one specific location or into a variable.
Could some one help me on this. Thanks for your help in advance.
#!/bin/ksh
PATH= /www/a/logs/
if [ -d $PATH ]
then
echo "is a directory"
ls -ltr | tail -1
fi
Or you can use the alternate evaluation notation, which goes something like this:
FILE=${{ ls -ltr | tail -1 }}
One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
subject: how to reterive a file from specific path using unix script