6

Say for example a script begins like this

#!/bin/bash
#$ -S /bin/bash
#$ -l hostname=qn*

and then later down the page the actual script comes into play. My question is what does the "#$" symbol mean or do?

E.Cross
  • 2,087
  • 5
  • 31
  • 39

4 Answers4

6

Lines beginning with # are comments. The first line may begin with #!, but it's still a comment to bash and is merely used to indicate the interpreter to use for the file. All other lines beginning with # are absolutely unimportant to bash, whether the next character is $ or anything else.

sorpigal
  • 25,504
  • 8
  • 57
  • 75
6

Are you by any means running on a batch cluster? Like Sun Grid Engine? There might be special meanings in scripts intended to run as a batch job.

https://www.wiki.ed.ac.uk/display/EaStCHEMresearchwik/How+to+write+a+SGE+job+submission+script

Update:

above link blocks when used from stackoverflow.com (works from google.com)

alternatives:

snies
  • 3,461
  • 1
  • 22
  • 19
  • 1
    next time, instead of editing and removing most of your answer just write another one, the previous content of your answer may be useful to others. – KurzedMetal May 02 '12 at 15:33
  • well, i had just pointed out, that i had seen `#$`been used for options. But than i remembered having seen that, while i was using batch jobs, so i specified the answer. – snies May 02 '12 at 15:37
  • Yes, the script is used to run a command on a cluster. By the way, that link requires a login with a university account so I can't access it. – E.Cross May 02 '12 at 15:57
  • Funny link, if you copy paste the link into google search, the exact same link will be the first hit. And then it will work. Seems they have some kind of referer check in place. – snies May 02 '12 at 23:04
1

They seem to be parameters for the Oracle (ex-Sun) Grid Engine, look at this SO question or this one.

They are heavily using these kind of comments.

Community
  • 1
  • 1
KurzedMetal
  • 12,540
  • 6
  • 39
  • 65
0

Those line are important for queue systems like sbatch.

Cippo1987
  • 59
  • 7