Commit dcaa21bd authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-sh-functions: introduce startwith (instead of grep using)

parent aa2d9823
...@@ -215,13 +215,28 @@ rhas() ...@@ -215,13 +215,28 @@ rhas()
echo "$1" | grep -E -q -- "$2" echo "$1" | grep -E -q -- "$2"
} }
# bash specific
startwith()
{
# rhas "$1" "^$2"
[[ "$1" = ${2}* ]]
}
is_abs_path()
{
#echo "$1" | grep -q "^/"
startwith "$1" "/"
}
# copied from strings # copied from strings
is_dirpath() is_dirpath()
{ {
[ "$1" = "." ] && return $? [ "$1" = "." ] && return $?
rhas "$1" "/" # rhas "$1" "/"
startwith "$1" "/"
} }
filter_strip_spaces() filter_strip_spaces()
{ {
# possible use just # possible use just
...@@ -1012,11 +1027,6 @@ subst() ...@@ -1012,11 +1027,6 @@ subst()
} }
fi fi
is_abs_path()
{
echo "$1" | grep -q "^/"
}
check_core_commands() check_core_commands()
{ {
#which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)" #which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment