Created
August 7, 2014 21:15
-
-
Save binarytemple/6d43a3a41d444bcc09bb to your computer and use it in GitHub Desktop.
zsh - strip everything from a path except the base directory name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Path | |
| ``` | |
| i=.`/riak.logs.cloudstoragea08/2014-08-07T15:47:49.540310/console.log.2014-07-31-05 | |
| ``` | |
| Extract the base directory name | |
| ``` | |
| echo ${${i:2}%%/*} | |
| ``` | |
| Result | |
| ``` | |
| riak.logs.cloudstoragea08 | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment