2 ms·
Assuming blah is in a var named name, you can use: dirname => "${name%/*}" basename => "${name##*/}" Sadly you can't use it with !$ since it's not a v
by lloeki 9y ago
Assuming blah is in a var named name, you can use:
dirname => "${name%/*}"
basename => "${name##*/}"
Sadly you can't use it with !$ since it's not a variable. The closest you can do is:
$ ls foo/bar/baz
ls: foo/bar/baz: No such file or directory
$ last=!$; echo "${last##*/}"
baz
$ echo "${last%/*}"
foo/bar