Trying to understand some BASH script I ran into this line
local var=${3-16}
I understand the job part and the local part - my question is that the dash points to "$ {3-16}".
If I try:
$ maxi=${1-45}; echo $maxi 45 <-- result
Please explain the meaning of the stroke. Thanks
When executed ${parameter-default}(or ${parameter:-default}), if parameternot set, it will use the value default.
${parameter-default}
${parameter:-default}
parameter
default
So, in var=${3-16}, if $3not set, there varwill be 16, otherwise it varwill $3.
var=${3-16}
$3
var
Advanced Bash -Scripting Guide .
" , ...". (:- " ".) , ${3-16} "$3, , 16".
:-
${3-16}
16
Source: https://habr.com/ru/post/1569707/More articles:java.lang.Exception: public keys in response and keystore do not match - javaAngularJS promises without callback? - javascriptUsing an asynchronous transaction in a transaction - asynchronousNative file extension. Double-clicking does not process the file path. - c #Understanding the amount of hold with blocking access to it inside. - iosHow to convince ghc that adding a level is commutative (implement an obsessive transformation)? - haskellCall Set-AzureServiceDiagnosticsExtension with Role failed - azureLimit tomcat in spring boot to specific IP addresses - javaC ++, how to create a double class operator [] [] - c ++Dispose and Finalize implementation for Windows Silverlight Pages phone - c #All Articles