2010/03/29
Bash and sh (":") Both use colons in More Than One context. You'll see it Used as a separator ($ PATH, for example), as a modifier ($ {n: = "foo"}) and as a null operator ("while"). Also
'll see the null operator usage in "if-then" sections:
if ["$ T1" = "$ T2"] then: else echo "Nope" fi
In That case, the ": "is just a" do-nothing "place holder. The use
Probably That Causes The Most head-scratching is When It Appears at the Beginning of a line:
> somefile
What does That mean? Simply It clears out "somefile" or create an empty "somefile" if itDid not exist already. In MOST shells, You Would not Need the ":" at all - to '> somefile' Would work just as well. But That Would not work in csh - you'd get "Invalid null command." You Could
'cat / dev / null> somefile' But that's a lot of typing and is very Unix specific. You Could 'echo-n> somefile' on Many systems, pero on A Few You Might Need 'echo "\\ c"' instead. Using ':> somefile' is short, specific and avoids Not Unix variance in 'echo'. Another place you
Might see it is with conditional variable setting. For example, say we want to xx September to "foo" but only if it isn't Already set. We Can use use '$ {xx: = "foo"}' CHTMLwere given to me specifically for the purpose of reviewing them.
I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. If you have any question, please do feel free to contact me.
-
Psst - wanna work for yourself? -
Unix/Linux Troubleshooting e-book -
| - | Consulting | - | Advertise Here | Source: | http://feedproxy.google.com/~r/aplawrence/DOLL/~3/BE3LMajhF60/leading-colon.html
eva longoria ipad iphone
Lindsay Lohan maksim chmerkovskiy
0 comments:
Post a Comment