You are not logged in.
Hi. I'm looking at script I wrote a while back, and saw this line in it.
#: <<'END'
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)
Offline
Looks like a comment to me
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Yeah, me too. What would it mean if the '#' were removed?
Offline
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)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
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)
Offline