Re: I need to be root to run this script
Hi,
15 janv. 2020 à 14:41 de wooledg@eeg.ccf.org:
> On Tue, Jan 14, 2020 at 08:32:12PM -0800, Will Mengarini wrote:
>
>> And the ls -R would be helped by this:
>> for f in /etc/sudoers.d/*;{ [[ -f $f ]] && echo === "$f" && cat "$f";}
>>
>
> I'm *definitely* not a fan of stretching the shell's parser in that
> way (replacing do ... done with a braced command group).
>
I'm not a big fan about for loop over wildcard *. It lacks recursivity.
I don't know if one can nest sudoers directories inside sudoers.d but I would stick to:
find /etc/sudoers.d -type f -exec echo '{}' \; -exec cat '{}' \;
> That said, here's an alternative that you may find interesting:
>
> tail -n+1 /etc/sudoers.d/*
>
What's the pro of
tail -n +1 /etc/sudoers.d/*
compared to a simple cat as your tail is fetching from the 1st line so does cat?
NB: yes, indeed, I had an issue with my email client about the new line missing (LF) between the two commands ;)
Best regards,
l0f4r0
Reply to: