commit:     3690be148e96c428e51ff9f21b7572e100772e5f
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri May 20 09:23:16 2022 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri May 27 09:01:34 2022 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=3690be14

tools-reference/bash: Drop redundant quotation marks in [[ ]] tests

Remove a note that was recommending them. Use {} braces around
variable names throughout.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 tools-reference/bash/text.xml | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/tools-reference/bash/text.xml b/tools-reference/bash/text.xml
index 821d385..d00a65c 100644
--- a/tools-reference/bash/text.xml
+++ b/tools-reference/bash/text.xml
@@ -91,19 +91,19 @@ To do comparisons or file attribute tests, <c>[[ ]]</c> 
(preferred) or
 </p>
 
 <codesample lang="ebuild">
-# is $foo zero length?
-if [[ -z "${foo}" ]] ; then
+# is ${foo} zero length?
+if [[ -z ${foo} ]] ; then
        die "Please set foo"
 fi
 
-# is $foo equal to "moo"?
-if [[ "${foo}" == "moo" ]] ; then
+# is ${foo} equal to "moo"?
+if [[ ${foo} == "moo" ]] ; then
        einfo "Hello Larry"
 fi
 
-# does "${ROOT}/etc/deleteme" exist?
-if [[ -f "${ROOT}/etc/deleteme" ]] ; then
-       einfo "Please delete ${ROOT}/etc/readme manually!"
+# does ${ROOT}/etc/deleteme exist?
+if [[ -f ${ROOT}/etc/deleteme ]] ; then
+       einfo "Please delete ${ROOT}/etc/deleteme manually!"
 fi
 </codesample>
 
@@ -134,9 +134,9 @@ syntax is possible with the former. For a simple 
illustration, consider:
 </p>
 
 <codesample lang="ebuild">
-bash$ [ -n $foo ] &amp;&amp; [ -z $foo ] &amp;&amp; echo "huh?"
+bash$ [ -n ${foo} ] &amp;&amp; [ -z ${foo} ] &amp;&amp; echo "huh?"
 huh?
-bash$ [[ -n $foo ]] &amp;&amp; [[ -z $foo ]] &amp;&amp; echo "huh?"
+bash$ [[ -n ${foo} ]] &amp;&amp; [[ -z ${foo} ]] &amp;&amp; echo "huh?"
 bash$
 </codesample>
 
@@ -242,12 +242,6 @@ available:
   </tr>
 </table>
 
-<note>
-To check whether a variable is set and not blank, use <c>-n "${BLAH}"</c>
-rather than <c>-n $BLAH</c>. The latter will cause problems in some situations 
if
-the variable is unset.
-</note>
-
 </body>
 </subsection>
 

Reply via email to