The ":" in the shell
Actual case: A section of ===> in the HBase script
# for releases, add HBase & WebApps to CLASSPATH
# Webapps must come first else it messes up Jetty
if [-D "$HBASE _home/hbase-webapps"]; Then
Classpath=${classpath}: $HBASE _home
fi
if [-D "$HBASE _home/target/hbase-webapps"]; Then
classpath= "${classpath}:${hbase_home}/target"
fi
For F in $HBASE _home/hbase*.jar;
if [[$f = *sources.jar]]
Then
: # Skip Sources.jar
Elif [-F $f]
Then
Classpath=${classpath}: $f;
fi
Done
Recently looking at "Linux Programming (third edition)"
See page 42, ":" Command
Say ":" is an empty command, while true is equivalent to while :
But the following example does not understand it, the original text is as follows:
---------------------------------------------------------------------------
: The structure will also be used in the variable's condition settings, for example: //"Variable condition settings", what do you mean?
: ${var:=value} //This sentence can not understand, do not know what is doing
If not: The shell will try to treat $var as a command to handle //This sentence how to understand, do not know Ah, ${} What structure is this ?
Chinaunix Answer:
posted in 2007-12-04 15:16:47 | Just look at the author
: It's a null command, it's not doing anything,
: ${var:=value} is the ${var:=value}: The parameters of the command,
No: The shell will take ${var:=value} as command to handle, all to error
Programming in Unix.shell (Third edition). PDF The 12th chapter is detailed
Special symbols in the shell