File Name ↓ File Size ↓ Date ↓; Parent directory/-2011PSDSources/-2018-Jul-13 21:57: 3DQuickPress. 2 5 Cds Iso, Linux mode and Windows mode ISO. Index of /software. ICO, Name Last modified Size Description. PARENTDIR, Parent Directory,. CHEM Windows Desktop. 2013-01-30 15:56. Parent Directory - rufus-3.6.exe 2019-07-18 13:33 1.1M Rufus 3.6. Rufus 2.18 (Last version compatible with Windows XP and Windows Vista) rufus-2.18p.exe.

  1. Index Of Windows Xp Iso
  2. Index Of Windows 10 Iso 2018
  3. Index Of Iso Windows
Active2 months ago

I want to get just the name of the parent directory for a file.

Example: When I have path=/a/b/c/d/file, I want only d and not /a/b/c/d (which I get from dirname $path) as output.

Is there any sophisticated way to do this?

nixda
21.7k11 gold badges81 silver badges137 bronze badges
shraddhashraddha

5 Answers

It sounds like you want the basename of the dirname:

Gordon DavissonGordon Davisson
27k4 gold badges45 silver badges53 bronze badges

You can use pwd to get the current working directory, and use parameter expansion to avoid forking it into another (sub)shell.

Edit: proven source

Community
firefire

I think this is a less-resource solution:

edit: Sorry, nested expansion isn't possible in bash, but it works in zsh. Bash-version:

uzsoltuzsolt
julian67julian67

I like Julian67's answer above best, but here is a bit an expanded version:

Dominic van der ZypenDominic van der Zypen

Not the answer you're looking for? Browse other questions tagged linuxbashshell or ask your own question.

Posted by6 years ago
Archived

I wrote up this other list of ISO's for /r/homelab. I figure we could use a similar thread here for tech related ISO's. Let's get it rockin' shall we? I will assume 64bit, x86, and global download mirror site lists when possible. Note that I may duplicate in some areas if they fit both categories, trying to keep this at a minimum though.

Antivirus:

2018

Diagnostics LiveCD's:

Forensics:

Linux Distros. Standard: Download sound driver winxp.

Microsoft:

  • Windows 7 Home Premium SP1 (English, 64-bit) Direct iso link.

  • Windows 7 Professional SP1 (English, 64-bit) Direct iso link.

  • Windows 7 Ultimate SP1 (English, 64-bit) Direct iso link.

  • Windows 7 Home Premium SP1 (English, 32-bit) Direct iso link.

  • Windows 7 Professional SP1 (English, 32-bit) Direct iso link.

  • Windows 7 Ultimate SP1 (English, 32-bit) Direct iso link.

Index Of Windows Xp Iso

Iso

Index Of Windows 10 Iso 2018

Multiboot ISO's and tools:

Index Of Iso Windows

  • Daring Rescue * Note that this is an *.img bundle with some duplicate ISO's.

Repair focused LiveCD's:

Security:

  • Backtrack See Kali Linux for more recent version replacing Backtrack.

  • DAVIX Security visualization.

  • Icinga Nagios network monitoring fork.

Sysadmin related:

Resources to build this list:

2016

List more and I'll add them to the index. Feel free to suggest omissions, recategorization, or broken links.

<3 projectdp

55 comments