HackerTrans
TopNewTrendsCommentsPastAskShowJobs

cdrt

no profile record

Submissions

Why GNU su does not support the `wheel' group (2002)

ftp.gnu.org
148 points·by cdrt·vor 3 Jahren·143 comments

comments

cdrt
·vor 3 Jahren·discuss
Your example proves that not using arrays is worse. That loop will only run once and just print every element on one line. The array equivalent works as expected , _isn't_ affected by IFS, and can handle spaces in individual elements

    f='a b c d e'
    for i in "$f"; do echo $i; done
    # prints a b c d e

    f="a b c 'd e'"
    for i in $f; do echo $i; done
    # prints
    # a
    # b
    # c
    # 'd
    # e'

    f=(a b c 'd e')
    for i in "${f[@]}"; do echo $i; done
    # prints
    # a
    # b
    # c
    # d e
cdrt
·vor 3 Jahren·discuss
You wouldn’t iterate over `echo *` anyway. This works just fine in bash/sh:

    for file in *; do
        echo "$file"
    done
cdrt
·vor 3 Jahren·discuss
You’re thinking about it backwards

`su` predates `sudo` by a decade doesn’t offer the fine-grained control `sudo` has. With `su` if you have the root password, you can do anything you want as root. With `sudo` admins can configure what commands users are allowed to run as root and could specifically block `sudo bash` from running.