base.sh: shell_name()

This commit is contained in:
bol-van 2024-05-07 20:19:43 +03:00
parent ecab5b913e
commit aaa692b324

View File

@ -278,6 +278,22 @@ random()
echo $(( ($r % ($2-$1+1)) + $1 ))
}
shell_name()
{
[ -n "$SHELL_NAME" ] || {
[ -n "$UNAME" ] || UNAME="$(uname)"
if [ "$UNAME" = "Linux" ]; then
SHELL_NAME="$(readlink /proc/$$/exe)"
SHELL_NAME="$(basename "$SHELL_NAME")"
else
SHELL_NAME=$(ps -p $$ -o comm=)
fi
[ -n "$SHELL_NAME" ] || SHELL_NAME=$(basename "$SHELL")
}
}
std_ports()
{
HTTP_PORTS=${HTTP_PORTS:-80}