diff options
| author | Dimitris Kokkonis <kokkonisd@gmail.com> | 2020-10-10 12:31:09 +0200 | 
|---|---|---|
| committer | Dimitris Kokkonis <kokkonisd@gmail.com> | 2020-10-10 12:31:09 +0200 | 
| commit | 916dceba25fcca6d7d9858d25c409bc9984c5fce (patch) | |
| tree | fb9e604256d3c3267e0f55de39e0fa3b4b0b0728 /bash.html.markdown | |
| parent | 922fc494bcce6cb53d80a5c2c9c039a480c82c1f (diff) | |
| parent | 33cd1f57ef49f4ed0817e906b7579fcf33c253a1 (diff) | |
Merge remote-tracking branch 'upstream/master' into master
Diffstat (limited to 'bash.html.markdown')
| -rw-r--r-- | bash.html.markdown | 11 | 
1 files changed, 9 insertions, 2 deletions
| diff --git a/bash.html.markdown b/bash.html.markdown index 856db706..7ca4285b 100644 --- a/bash.html.markdown +++ b/bash.html.markdown @@ -23,7 +23,7 @@ translators:  ---  Bash is a name of the unix shell, which was also distributed as the shell -for the GNU operating system and as default shell on Linux and Mac OS X. +for the GNU operating system and as the default shell on most Linux distros.  Nearly all examples below can be a part of a shell script  or executed directly in the shell. @@ -88,6 +88,11 @@ echo ${Variable: -5} # => tring  # String length  echo ${#Variable} # => 11 +# Indirect expansion +OtherVariable="Variable" +echo ${!OtherVariable} # => Some String +# This will expand the value of OtherVariable +  # Default value for variable  echo ${Foo:-"DefaultValueIfFooIsMissingOrEmpty"}  # => DefaultValueIfFooIsMissingOrEmpty @@ -225,7 +230,9 @@ cat file.txt  # We can also read the file using `cat`:  Contents=$(cat file.txt) -echo "START OF FILE\n$Contents\nEND OF FILE" # "\n" prints a new line character +# "\n" prints a new line character +# "-e" to interpret the newline escape characters as escape characters +echo -e "START OF FILE\n$Contents\nEND OF FILE"  # => START OF FILE  # => [contents of file.txt]  # => END OF FILE | 
