Trivial question. What is the most elegant function myfunction
that allows to produce the following output?
# myfunction "a
b
c
d"
a%0Db%0Dc%0Dd%0D
Trivial question. What is the most elegant function myfunction
that allows to produce the following output?
# myfunction "a
b
c
d"
a%0Db%0Dc%0Dd%0D
Using parameter expansion - substitution:
myfunction () {
echo "${1//$'\n'/%0D}"%0D
}