Heard of it in this very interesting article.
drwx------ 64 bob developers 4,0K jan. 15 20:38 bob/and we would like Alice to have read access to /home/bob/, we can :
Flag | Usage |
---|---|
-b --remove-all |
|
-d --default | All operations apply to the default ACL
|
-m | modify an existing ACL entry |
-R | Recursive : apply rights to all files and directories. -R must be supplied before -m : -Rm |
-x | remove an ACL entry :
setfacl -x u:kevin someFile
|
setfacl: Option -m: Invalid argument near character 6What's wrong ?
user:httpd:rwx 123456Something's wrong with the username
optionName | shortOption | Usage |
---|---|---|
noexec | n | read commands but do not execute them (syntax check) |
errexit | e | abort script at first error : when a command exits with non-zero status, except in these constructs :
|
nounset | u | leave script and display an error message when using an unset variable |
pipefail |
|
|
verbose | v | print each command to stdout before executing it |
xtrace | x | like verbose, but expands commands |
mandatory flagthat should be used in all scripts. But it's also considered by others as a bad / useless practice (stackoverflow.com, mywiki.wooledge.org) because :
if
, [ ], ) evaluates to false
:
false
status is what tests are forfalse
as an error and exiting unconditionally is an over-reaction which brings nothing to the safety of scriptsif
, until
, while
block&&
or ||
)!
#!/usr/bin/env bash set -e echo -n 'hello' true echo ' world'
#!/usr/bin/env bash set -e echo -n 'hello' false echo ' world'
#!/usr/bin/env bash set -e echo -n 'hello' if true; then echo -n ' wonderful' fi echo ' world'
#!/usr/bin/env bash set -e echo -n 'hello' if false; then echo -n ' wonderful' fi echo ' world'
If you run set -e in a terminal, this will affect the current shell and any further command your "victim" will type. At the 1st non-success return code met (which is VERY easy : try TAB-completing like cd TAB), an exit will be fired, closing the terminal
If you _unintentionally_ run that joke on yourself (), you can disable the -e flag with : set +e
file1 file2 file3 3 files of the current directory
... ... ... ... all of them