From cc1a2dd903690b3ee4fa0fd0b85ff8c798c64cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20S=C3=BCt=C5=91?= Date: Thu, 9 Oct 2025 10:54:04 +0200 Subject: [PATCH] Update Variables.md * Simplify backslash example to escape special characters * More intuitive example of variables with command output --- tutorials/learnshell.org/en/Variables.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tutorials/learnshell.org/en/Variables.md b/tutorials/learnshell.org/en/Variables.md index 98efe3f0a..17e972bf1 100644 --- a/tutorials/learnshell.org/en/Variables.md +++ b/tutorials/learnshell.org/en/Variables.md @@ -12,7 +12,7 @@ Referencing the variables A backslash "\\" is used to escape special character meaning PRICE_PER_APPLE=5 - echo "The price of an Apple today is: \$HK $PRICE_PER_APPLE" + echo "The price of an Apple today is: \$ $PRICE_PER_APPLE" Encapsulating the variable name with ${} is used to avoid ambiguity @@ -27,7 +27,8 @@ Encapsulating the variable name with "" will preserve any white space values Variables can be assigned with the value of a command output. This is referred to as substitution. Substitution can be done by encapsulating the command with `` (known as back-ticks) or with $() FILELIST=`ls` - FileWithTimeStamp=/tmp/my-dir/file_$(/bin/date +%Y-%m-%d).txt + echo "The current directory contains the following files and folders:"$FILELIST + echo "The current directory contains the following files and folders:"$(`ls`) Note that when the script runs, it will run the command inside the $() parenthesis and capture its output.