Skip to content
Snippets Groups Projects
Commit ca9cc579 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update ph.require

parent 805463ca
Branches
No related tags found
1 merge request!161Add systemdunit
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
# 2023-06-22 v1.11 <axel.hahn@unibe.ch> fix ph.toUnit with float values; shell fixes # 2023-06-22 v1.11 <axel.hahn@unibe.ch> fix ph.toUnit with float values; shell fixes
# 2023-08-24 v1.12 <axel.hahn@unibe.ch> toUnit got 3rd param for count of digits after "." # 2023-08-24 v1.12 <axel.hahn@unibe.ch> toUnit got 3rd param for count of digits after "."
# 2023-08-30 v1.13 <axel.hahn@unibe.ch> reverse return code in ph.hasParamoption to unix like return codes: 0=true; <>0 = false # 2023-08-30 v1.13 <axel.hahn@unibe.ch> reverse return code in ph.hasParamoption to unix like return codes: 0=true; <>0 = false
# 2023-09-05 v1.14 <axel.hahn@unibe.ch> ph.require - show error below status line
# ====================================================================== # ======================================================================
...@@ -62,10 +63,11 @@ function ph.abort(){ ...@@ -62,10 +63,11 @@ function ph.abort(){
# check required binaries in the path # check required binaries in the path
# param(s) string name of binary to check with "which" command # param(s) string name of binary to check with "which" command
function ph.require(){ function ph.require(){
which $* >/dev/null local _out;
if [ $? -ne 0 ]; then if ! _out=$( which $* 2>&1 ); then
ph.setStatus "unknown" ph.setStatus "unknown"
ph.status "$0 requires the following tools to run: $*" ph.status "$0 requires the following tools to run: $*"
echo "$_out"
ph.exit ph.exit
fi fi
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment