In a shell script, my understanding is that "$@" expands to the script arguments, quoting them as needed. For instance this forwards the script arguments to gcc:

 gcc -fPIC "$@"

When using the bash pass-to-stdin syntax `<<<` though, "@$" doesn't work as I would expect it to.

 #!/bin/bash
 cat <<< "$@"

Calling the script as `./test.sh foo "bar baz"` gives

 foo bar baz

I would expect

 foo "bar baz"

Is there a way to write a shell script that prints it's arguments as you would write them on the shell prompt? For instance: a hint as to what command to use next, including the script arguments in the hint.