Trying to use sed within eval statement?
#!/bin/bash
declare COMMAND="sudo sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config"
theResponse=$(${COMMAND} 2>&1)
echo "${theResponse}"
I cannot seem to figure out why the above script generates the following error...
sed: -e expression #1, char 1: unknown command: `''
The sed command works fine via the shell.
eval
in the title? – Kusalananda Apr 18 '21 at 09:13eval
there, just regular old word splitting on the command line. – ilkkachu Apr 18 '21 at 09:53