Clear "unknown" characters from bash script

set | grep TERM
TERM=xterm case "${TERM:-dumb}" in _rvm_old_traps=$( __rvm_grep -E 'EXIT|HUP|INT|QUIT|TERM' <(trap) ); trap '__rvm_teardown_final ; set +x' EXIT HUP INT QUIT TERM; trap - EXIT HUP INT QUIT TERM; case "${TERM:-dumb}" in
echo $TERM
xterm

in shell output i'm getting this strange character:[3;J[H[2J and few lines below desired output

Worth mentioning full code (it's powershell script running under linux)

#!/bin/bash
out=$(pwsh /usr/lib/zabbix/externalscripts/1.ps1)
zabbix_sender -z localhost -p 10051 -s "London" -k status.azure -o "$out"

when adding this line clear | hexdump

i'm getting

0000000 5b1b 3b33 1b4a 485b 5b1b 4a32
000000c

How to clear this from output ?

clear | od -bc output:

0000000 033 133 063 073 112 033 133 110 033 133 062 112 033 [ 3 ; J 033 [ H 033 [ 2 J
0000014
1

1 Answer

i solved this by workaround:

-in powershell script redirected output to file

-in shell script added line for reading content of that file

-sending file content to zabbix

-no more strange symbols

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like