Closed emilheunecke closed 3 years ago
Seems like it's actually the VT100 control codes in the strings and comment that are causing problems... This works:
do_load () {
local service=$1
local tar=$2
echo "Loading image from $_path_root/$service/images/$tar"
evalfunc() {
if [ -f load_log ]
then
cat load_log `# See http://www.cse.psu.edu/~kxc104/class/cmpen472/16s/hw/hw8/vt100ansi.htm`\
| sed "s/\x1B//g" `# Remove ESC`\
| sed '' `# Remove `\
| sed "s/\r//g" `# Remove carriage return`\
| tail -1
fi
}
start_spinner_eval "evalfunc"
faketty docker load -i $_path_root/$service/images/$tar >load_log
stop_spinner
rm load_log
printf '\033' # Clear current line
}
But only if I remove BOTH the last printf command's VT100 control code string content, the second sed command's VT100 control code string content AND the VT100 control codes in the comment next to the second sed command!
I just hit this same issue, found this which seemed to work as documented: https://argbash.readthedocs.io/en/stable/index.html#limitations
Something like...
do_load () {
printf '\033[2K' # Clear current line ... match square bracket: ]
}
Closing since limitation is already documented.
Debugging process...
I sometimes like to use [this](https://stackoverflow.com/a/12797512/14756965) technique to add comment to multiline scripts in bash. However, it seems like m4 considers the closing backtick ` and continuation character \ as part of the comment, so argbash throws an error: ``` /usr/bin/m4:stdin:36: ERROR: end of file in string autom4te: /usr/bin/m4 failed with exit status: 1 You seem to have an unmatched square bracket on line 6: # [ <-- needed because of Argbash Error during autom4te run, aborting! ``` I guess there isn't much there can be done since the syntax is incompatible with m4, but I wonder if anyone has a fix or some other way to accomplish the same thing?