sudo issue
Ralf Mardorf
silver.bullet at zoho.com
Tue Aug 2 19:24:27 UTC 2016
On Tue, 02 Aug 2016 23:44:27 +1000, Karl Auer wrote:
>On Tue, 2016-08-02 at 23:00 +1000, blind Pete wrote:
>> You could probably pass the wild card, rather than what the
>> wild card expands to (as Ralf), to sudo by escaping it.
>>
>> $ sudo cp -rp /mnt/archlinux/.chuser/.home/.jwm\* /tmp/
>
>Sadly no - because sudo does not execute the command in a shell, so
>arguments passed to it are not processed as a shell would.
>
> kauer at kt:~$ sudo ls /root
> z1.txt
> kauer at kt:~$ sudo ls /root/z\*
> ls: cannot access '/root/z*': No such file or directory
The only workaround for wilde card usage seems to be the shell.
I tried to imagine some workaround, comparable to the tee approach...
[weremouse at moonstudio ~]$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
ondemand
ondemand
[weremouse at moonstudio ~]$ sudo echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
bash: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
[weremouse at moonstudio ~]$ echo performance | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance
[weremouse at moonstudio ~]$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
...but for wilde card usage there seems to be no such workaround, resp.
an equivalent quasi is to run a shell.
Regards,
Ralf
More information about the ubuntu-users
mailing list