I'm trying to run a command that will send a POST request with data that is a result of another command. An example will say it all:
wget -O- --post-data=$(ls -lah) http://192.168.30.53/api/v2/network/clients
This is obviously wrong, but I have no idea how to "escape" the value of ls -lah
command before passing it as a parameter.
Current output if needed:
wget: invalid option -- '>'
wget: --wait: Invalid time period '-r--r--'
You do not escape - you quote the usage. Check your scripts with shellcheck.
... --post-data="$(ls -lah)" ...