Special symbols in the shell

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.