The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Getting file name ?
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Getting file name ?
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
2
(
permalink
)
01-02-2009
joeyg
modérateur
Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
try the following
Code:
file_name=`ls -ltr /dir1/dir2 | grep '^-' | tail -1 | awk '{print $9}' `
to avoid the directory path in your variable
joeyg
View Public Profile
Find all posts by joeyg
Find joeyg's past nominations received
Find joeyg's present nominations given