[arch-projects] [INITSCRIPTS][PATCH] rc.d: list [started|stopped|auto|noauto|daemon]
Seblu
seblu at seblu.net
Tue Aug 23 04:36:27 EDT 2011
On Tue, Aug 23, 2011 at 10:01 AM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
>
> Hm, wouldn't that mean we would never be able to explicitly list daemons
> called "started", "stopped", "auto" and "noauto"? I know that this is
> nit-picking, but I would prefer another argument "daemons" or "all",
> followed by a list of daemons, so we could use:
>
> * `rc.d list daemons` to list all daemons (or just `rc.d list`).
> * `rc.d list started` to list all running daemons.
> * `rc.d list daemons sshd gpm` to list specific daemons only.
> * `rc.d list started sshd gpm` to list specific running daemons only.
Bof. I prefer something like rc.d list \auto to list auto deaemons.
It's less complicated.
>
> Also, you should not indent mixing tabs and spaces. This breaks
> indentation for everyone using a different tab width.
I checked but i don't see mixing tabs and space.
The only point where i use space for indentation is in string of
usage. Where it's correct to ensure a proper display.
Can you be more precise.
>
>> + esac
>> + done
>> + # if no daemon are specified take all executable file in /etc/rc.d
>> + if ! [[ $daemons ]]; then
>
> "[[ ! $daemons ]]". Or any reason to do the negation outside the
> conditional expression here?
Reason to do it inside ?
>
>> + cd /etc/rc.d
>> + for d in *; do
>> + [[ -x "$d" && ! -d "$d" ]] && daemons=(${daemons[@]} "$d")
>
> 'daemons=("${daemons[@]}" "$d")'. Just to be sure we don't fail here if
> a daemon ever contains a space (and since you used proper quoting
> everywhere else).
i tested with a daemon with space. np.
>> --- a/zsh-completion
>> +++ b/zsh-completion
>> @@ -19,7 +19,7 @@ _rc.d () {
>> _arguments "*: :"
>> ;;
>> list)
>> - _arguments "2: :(started stopped)"
>> + _arguments "*: :(started stopped auto noauto $(echo /etc/rc.d/*(N-*:t)))"
>
> Whey, another winner of the "Useless use of echo" award [1]! :)
For a weird reason, some daemons are missing without the use of echo
here. I doesn't succeed to reproduce it, so i will change this.
Thanks for review!
--
Sébastien Luttringer
www.seblu.net
More information about the arch-projects
mailing list