Hello,
I am looking for a reliable solution to echo (from a ksh script) everythin as it is given to the echo command (avoiding any variable intepreting in case some exists and also signs like ' , " etc. )...
I want to avoid using "\" before every e.g. $ sign ...
is it possible use any brackets combination to achive this?
or maybe some dedicated echo_function () in a script?
I found that :
cat < EOF
$V
EOF
return value of variable, but:
cat < "EOF"
$V
EOF
doesn't.
I tried following function but it doesn't do what is expected:
Code:
$ cat ./printline.ksh
my_echo () {
cat << EOF
$*
EOF
echo $*
}
echo 11111111:
my_echo /usr/bin/perl -n&#$45234i !!!-e '$_ =~%34 /^aaaaaaaa/ ) { print \"%#$""""'''````#$_\"} else {print}' ffffff
grep 45234i $0|sed s/^my_echo\ //g
echo 22222222:
my_echo /usr/bin/perl -#223mnnni -e '''''!!!''$_ =~#@2424""" /^cc"""/ ) { print \"#$_\"} else {print}' %%%%%%%%%%%%%%%%%%%%%5
grep 223mnnni $0|sed s/^my_echo\ //g
$ ./printline.ksh
11111111:
/usr/bin/perl -n&#$45234i !!!-e '$_ =~%34 /^aaaaaaaa/ ) { print \"%#$""""'''````#$_\"} else {print}' ffffff
grep 45234i $0|sed s/^my_echo\ //g
22222222:
/usr/bin/perl -n
/usr/bin/perl -n
/usr/bin/perl -#223mnnni -e !!!$_ =~#@2424""" /^cc"""/ ) { print \"#$_\"} else {print} %%%%%%%%%%%%%%%%%%%%%5
/usr/bin/perl -#223mnnni -e !!!$_ =~#@2424""" /^cc"""/ ) { print \"#$_\"} else {print} %%%%%%%%%%%%%%%%%%%%%5
/usr/bin/perl -#223mnnni -e '''''!!!''$_ =~#@2424""" /^cc"""/ ) { print \"#$_\"} else {print}' %%%%%%%%%%%%%%%%%%%%%5
grep 223mnnni $0|sed s/^my_echo\ //g
$