For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > Bash > Current Directory

Current Directory

Created by dave. Last edited by dave, 10 years and 148 days ago. Viewed 2,446 times. #1
[edit] [rdf]
labels
attachments
(2013-11-25)

Problem

What is the current directory called?

Solution

"${PWD##*/}"
This is suitable for shell scripts; for example:
TARGET="${PWD##*/}"
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt