dirname and basename in pure bash
This commit is contained in:
parent
0b2da67759
commit
2942adc0c8
5
gaboshlib/g_basename.sh
Normal file
5
gaboshlib/g_basename.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
function g_basename {
|
||||||
|
g_basename_result="${1##*/}"
|
||||||
|
g_basename_result="${g_basename_result:-/}"
|
||||||
|
}
|
||||||
|
|
5
gaboshlib/g_dirname.sh
Normal file
5
gaboshlib/g_dirname.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
function g_dirname {
|
||||||
|
g_dirname_result="${1%"${1##*[!/]}"}"
|
||||||
|
g_dirname_result="${g_dirname_result%/*}"
|
||||||
|
g_dirname_result=${g_dirname_result:-/}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user