Hi. I'm looking at script I wrote a while back, and saw this line in it.
No doubt, I had a purpose, googled it, found this snippet, pasted it, it did what I wanted it to do, then moved on. Does this mean anything, or is it just some cryptic comment?
Last edited by Pacopag (2012-11-25 16:35:22)
Looks like a comment to me
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
You assume people are rational and influenced by evidence. You must not work with the public much. -- Trilby
How to Ask Questions the Smart Way
Yeah, me too. What would it mean if the '#' were removed?
It's a commented here-document. Everything between that line and a subsequent line with just "END" on it is ignored as a comment. If the hash symbol weren't there it'd still be a here-document ... but it wouldn't do anything in that context as it follows a ":". This would be just like `: filename` where filename was a file that include whatever was in your here-document. The "true" colon doesn't use any input data, so it is ignored.
EDIT: scratch that, I was almost completely wrong. The colon and the open here-document would in effect comment out everything in the here-document. As that line is commented with the hash, the here-document is never opened. So with the hash that line does absolutely nothing, and subsequent lines are interpreted by bash. Without the hash, subsequent lines would be ignored.
Last edited by Trilby (2012-11-25 16:35:19)
Aha. And now I remember it's purpose. Thanks Trilby.
Edit: Indeed, I remember now using it to comment out a block of the script.
Last edited by Pacopag (2012-11-25 16:36:00)