Skip to content

Commit 01ee3a8

Browse files
authored
adding an alternate shorter way that does not depend on the basename (#2191)
1 parent 1f681bd commit 01ee3a8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

bash.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ echo "${str: -5:5}" # "world"
175175
src="/path/to/foo.cpp"
176176
base=${src##*/} #=> "foo.cpp" (basepath)
177177
dir=${src%$base} #=> "/path/to/" (dirpath)
178+
dir=${src%/*} #=> "/path/to" (dirpath)
178179
```
179180

180181
### Prefix name expansion

0 commit comments

Comments
 (0)