Changeset ae27cdc


Ignore:
Timestamp:
11/16/2022 04:15:52 PM (18 months ago)
Author:
Pierre Labastie <pierre.labastie@…>
Branches:
11.3, 12.0, 12.1, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, lazarus, lxqt, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, xry111/llvm18, xry111/xf86-video-removal
Children:
3619a5b9
Parents:
4635a45d
git-author:
Pierre Labastie <pierre.labastie@…> (11/16/2022 03:42:25 PM)
git-committer:
Pierre Labastie <pierre.labastie@…> (11/16/2022 04:15:52 PM)
Message:

shadow: don't use <cond> && <cmd> for conditional

Explain why in a comment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • postlfs/security/shadow.xml

    r4635a45d rae27cdc  
    558558          <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
    559559        </indexterm>
    560 
    561 <screen role="root"><userinput>[ -f /etc/login.access ] &amp;&amp; mv -v /etc/login.access{,.NOUSE}</userinput></screen>
     560<!-- to editors: it is a common belief that:
     561        if <condition>; then <command>; fi
     562     is equivalent to:
     563        <condition> && <command>
     564     This is not true in bash; try:
     565        ([ 0 = 1 ] && echo not reachable); echo $? # echoes 1
     566     vs
     567        (if [ 0 = 1 ]; then echo not reachable; fi); echo $? # echoes 0
     568     So in scripts that may call subshells (for example through sudo) and
     569     that need error reporting, the outcome _is_ different. In all
     570     cases, for bash, the "if" form should be preferred.-->
     571<screen role="root"><userinput>if [ -f /etc/login.access ]; then mv -v /etc/login.access{,.NOUSE}; fi</userinput></screen>
    562572      </sect4>
    563573
     
    578588        </indexterm>
    579589
    580 <screen role="root"><userinput>[ -f /etc/limits ] &amp;&amp; mv -v /etc/limits{,.NOUSE}</userinput></screen>
     590<screen role="root"><userinput>if [ -f /etc/limits ]; then mv -v /etc/limits{,.NOUSE}; fi</userinput></screen>
    581591
    582592        <caution>
Note: See TracChangeset for help on using the changeset viewer.