02-04-2008
help with ls commad
hi
I want to display the latest file in script.
say for example
file.txt1
file.txt2
file.txt3(latest)
in the script
var1=`ls -ltr file.txt* | tail-1`
echo $var1
This is what i am using. But this says that file.txt*: No such file or directory
To the same script if I pass file.txt* as parameter and
when i use the below it is working
var1=`ls -ltr $1 | tail-1`
echo $var1
Can some help me with first method
Thanks in advance
Ammu
4 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
Can someone please tell me the command to delete a NESTED DIRECTORY.
here is my email address:
firewalls007@hotmail.com (2 Replies)
Discussion started by: Javed Akram
2 Replies
2. UNIX for Advanced & Expert Users
I modified the .profile of a user id to start "script" when the user logs in.
When the user logs out, I have added a trap command in the .profile file to capture the exit signal.
And in that trap command, I have added the creation of a file called .logout.
And in the .logout file, I have added... (3 Replies)
Discussion started by: ggayathri
3 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I have a directory structure as below
/home/gad/Merl/a/a1.txt
/home/gad/Merl/b/a1.txt
/home/gad/Merl/c/a1.txt
How can I find the file a1.txt but not from directory 'a' and it(the filw) should loaded 6 days ago..
Can any one pls help,quick reply much appriciated..
Thanks. (1 Reply)
Discussion started by: jagadish_gaddam
1 Replies
4. Programming
Hi guys,
i used the call "sytem" using ... in a cobol program.
At the moment i stoped at an empasse, how cam I retrive the execution's result of unix command?
Explenation, I made an 'pwd' command, and I must to have the directory inside the program.
How can have this result? (2 Replies)
Discussion started by: Prosy60
2 Replies