mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
dbginfo.sh: ensure compatibility with /bin/dash
some versions of /bin/dash do interpreted our commands different, which causes a variable failure and termination of the script. e.g. a new line char "\n" will split the cmd_type to a multiple line variable not working with the followup commands. adding the head command does avoid multiline variables now. Problem found in Ubuntu 20.4 and some older Ubuntu versions Reviewed-by: Mario Held <mario.held@de.ibm.com> Signed-off-by: Joern Siglen <siglen@de.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
d529ba07d3
commit
9f93af614f
@@ -1160,8 +1160,9 @@ call_run_command() {
|
||||
local rc=0
|
||||
local cmd="${1}"
|
||||
local logfile="${2}"
|
||||
# extract the raw_command and set cmd_type
|
||||
local raw_cmd=$(echo "${cmd}" | sed -ne 's/^\([^[:space:]]*\).*$/\1/p')
|
||||
# extract the raw_command and set cmd_type, as some shell might split into
|
||||
# several lines restrict the cmd echo to the first line only
|
||||
local raw_cmd=$(echo "${cmd}" | head -1 | sed -ne 's/^\([^[:space:]]*\).*$/\1/p')
|
||||
local cmd_type=$(type ${raw_cmd} | cut -d' ' -sf4,5)
|
||||
|
||||
echo "#######################################################" >> "${logfile}"
|
||||
|
||||
Reference in New Issue
Block a user