Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-10-2005, 04:17 PM   #1
Registered: Apr 2005
Distribution: Fedora Core 4
Posts: 88

Rep: Reputation: 15
Question ShellScrpit : select the last directory


Within a shellscript how could I select the last directory of a path and look inside it? Let's say I have

something like:

bash script_find /dir1/dir2/dir3 <------ (argument given by user, could be
something else)

I want to select the last subdirectory and display all it's content(ls -l)

Thanks in advance for your answers
Old 05-10-2005, 04:22 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Just use:
ls -l $1
Old 05-10-2005, 05:37 PM   #3
Registered: Apr 2005
Distribution: Fedora Core 4
Posts: 88

Original Poster
Rep: Reputation: 15
Thanks david_ross !


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync syntax to skip directory, but copy select files.. tnicol Linux - Software 3 07-24-2007 06:40 AM
No longer able to select files from my user home directory oily_rags SUSE / openSUSE 4 11-06-2005 02:39 PM
Select() did not select my socket thvo Programming 1 05-08-2005 01:20 AM
gtk directory select MylesCLin Programming 1 12-16-2004 06:54 PM
Using Select to make a simple directory menu why doesn't it work ctrimble Programming 5 06-07-2004 02:21 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration