I have a function in bash that accepts unknown amount of arguments:
printAndRunCommand() {
printf "$@"
eval "$@"
}
Because printf accept only single argument, when I run this command with
printAndRunCommand wget stackoverflow.com
only wget
gets printed. I can archive the same effect using echo
command, but I use printf specific characters like color change, in origin command looks like printf '"\033[4;36m$@\e[0;33;40m"
.
How do I pass "$@"
to printf
command?