Skip to content

Commit

Permalink
iiab-diagnostics: Cleaner output if COMMAND NOT FOUND
Browse files Browse the repository at this point in the history
  • Loading branch information
holta committed Jan 18, 2025
1 parent e2113c5 commit a81856d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/iiab-diagnostics
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,18 @@ function cat_cmd() { # $1 = command + params, $2 = explanation
spc_params=$(echo "$1" | sed 's/^\s*\S\S*\s*/ /;s/\s*$//') # Drop command on left; Keep a single space + params on right; RTrim
#spc_params=$(echo "$1" | sed 's/^\s*\S*//;s/\s*$//;s/^\s\s*/ /') # LTrim + drop original path + command on left; RTrim; Compress whitespace in between
#spc_params=$(echo "$1" | sed 's/^[[:blank:]]*[^[:blank:]]*//;s/[[:blank:]]*$//;s/^[[:blank:]][[:blank:]]*/ /') # Equivalent (POSIX compliant)
if [[ $2 == "" ]]; then
echo "COMMAND: $path_cmd$spc_params" >> $outfile
if [[ $path_cmd == "" ]]; then
if [[ $2 == "" ]]; then
echo "COMMAND: $1" >> $outfile
else
echo "COMMAND: $1 # $2" >> $outfile
fi
else
echo "COMMAND: $path_cmd$spc_params # $2" >> $outfile
if [[ $2 == "" ]]; then
echo "COMMAND: $path_cmd$spc_params" >> $outfile
else
echo "COMMAND: $path_cmd$spc_params # $2" >> $outfile
fi
fi
echo >> $outfile
if [[ $path_cmd == "" ]]; then
Expand Down

0 comments on commit a81856d

Please sign in to comment.