I have a command that is similar to this minimal example:
$ sh -c 'echo "1=$1"' _ foo
1=foo
$
When I want to run it through sudo
, it stops working:
$ sudo -i -u user -- sh -c 'echo "1=$1"' _ foo
1=
$
I have a command that is similar to this minimal example:
$ sh -c 'echo "1=$1"' _ foo
1=foo
$
When I want to run it through sudo
, it stops working:
$ sudo -i -u user -- sh -c 'echo "1=$1"' _ foo
1=
$
sudo
, it stops working" – Not because of solesudo
, but because ofsudo -i
. Possibly related:sudo -s <command>
runs command in a shell, but wildcards or metacharacters not working. – Kamil Maciorowski Jun 12 '23 at 21:40sudo -i -u user -- sh -c 'echo "1=${1}"' _ foo
– don_aman Jun 12 '23 at 22:26