[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setting path for root after "sudo su" and "sudo" for Debian Bullseye (11)



On Sun, May 22, 2022 at 10:48:44AM -0500, Tom Browder wrote:
> Yes, I actually used that syntax but failed to put it in the message—same
> result:
> 
>      sudo —preserve-env=PATH raku -v
>      sudo: raku: command not found

You might have misspelled --preserve.  It's hard to tell, because
what you've got in your email message is a Unicode character, represented
in UTF-8 by the three bytes 0xe2 0x80 0x94.  According to a Google search,
that's "em dash U+2014".  So, it's not clear whether you actually
typed (or pasted) that em dash character into your shell, or whether
you had -- in your shell, but it somehow got mangled into em dash when
you pasted (or typed?) it into your email.

Somewhat to my surprise, sudo *does not* report an error if you feed it
an em dash in this position:

unicorn:~$ echo "$PATH"
/home/greg/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/greg/.dotnet/tools:/sbin:/usr/sbin
unicorn:~$ sudo sh -c 'echo "$PATH"'
[sudo] password for greg: 
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
unicorn:~$ sudo --preserve-env=PATH sh -c 'echo "$PATH"'
/home/greg/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/greg/.dotnet/tools:/sbin:/usr/sbin
unicorn:~$ sudo —preserve-env=PATH sh -c 'echo "$PATH"'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

So... we literally can't tell what you did.

Still wondering why you can't just use the other solutions you've been
given.  If it's the Docker thing, tell me now, so I can stop wasting my
time.


Reply to: