Meng Zhao
Meng Zhao

Reputation: 131

What does #$ syntax mean when using inside a bash script?

something like this, or in the example:

#! /bin/bash

#$ -S abc

I guess '-S' may be a arg to bash, but I am not sure, could anybody give me some reference about this kind of structure?

Thanke you very much.

edit:

sorry about "abc" things (It is a place holder), the main point is what does "#$" mean? How can I use it in a script? By the way, I could not find topics related to these two characters ("#$", also "#$") in stackoverflow, as well as "#!"(shebang), so is there any technology involving here? (escaping? vabatim?)

Upvotes: 0

Views: 504

Answers (2)

Meng Zhao
Meng Zhao

Reputation: 131

Finally, using "SGE -S" in google got this web page: https://uwaterloo.ca/math-faculty-computing-facility/resources/researchers/computing/sun-grid-engine-sge-batch-queuing-system/basic-sun-grid-engine-sge-job

So it appears "#$" is a SGE defined construct, but a bash defined construct. Thanks @usr for the clue.

Upvotes: 0

P.P
P.P

Reputation: 121357

This is probably an option used in job schedulers. From the Sun grid engine manual:

  -S [[hostname]:]pathname,...
          Available for qsub, qsh and qalter.

      Specifies the interpreting shell for the job. Only  one
      pathname  component  without  a host specifier is valid
      and only one path name for a  given  host  is  allowed.
      Shell paths with host assignments define the interpret-
      ing shell for the job if  the  host  is  the  execution
      host. The shell path without host specification is used
      if the execution host matches none of the hosts in  the
      list.

Typically, I have seen it used like:

#!/bin/bash
# Force Grid Engine to use bash shell
#$ -S /bin/bash
...

So, in your case it appears to be using a shell called abc (never heard of it. Probably it's a symlink to some other shell? or you changed your actual example?).

Upvotes: 1

Related Questions