Views:
11,915β
Votes: 3β
Tags:
bash
scripts
syntax
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/1054677
Title:
What is the point of the bash Null-operator ":", colon?
ID:
/2018/07/13/What-is-the-point-of-the-bash-Null-operator-____-colon_
Created:
July 13, 2018
Edited: July 13, 2018
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
You can use it on the positive test of an if
command when you only want to do something on the negative side. For example:
if [[ True == False ]]; then
:
else
echo "true <> flase"
fi
Without the :
bash would generate a syntax error.
This is an oversimplified example. Generally you would use such a technique in preliminary coding when you havenβt written that code segment yet and just need something that doesnβt generate an error.