1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-11-24 05:37:39 +00:00

Merge pull request #192 from SabryTarek/master

add equivalent to bash command
This commit is contained in:
Julien Le Coupanec 2021-04-16 18:08:15 +02:00 committed by GitHub
commit b6dc8fb718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,6 +192,7 @@ declare -r # makes the variables read-only
declare -x # marks the variables for export via the environment
${varname:-word} # if varname exists and isn't null, return its value; otherwise return word
${varname:word} # if varname exists and isn't null, return its value; otherwise return word
${varname:=word} # if varname exists and isn't null, return its value; otherwise set it word and then return its value
${varname:?message} # if varname exists and isn't null, return its value; otherwise print varname, followed by message and abort the current command or script
${varname:+word} # if varname exists and isn't null, return word; otherwise return null