|
Getting file name ?
Assuming /dir1/dir2 has two file
file1
file2
If I get the file name which includes the dir name using command
file_name=`ls -ltr /dir1/dir2/* | grep '^-' | tail -1 | awk '{print $9}' `
then I get file_name which includes the /dir1/dir2 also.
if I want to get just the filename which should be file1 or file2 then how can I do that?
|