bash scripting across linux and solaris

Stephen Adler adler-wRvlPVLobi1/31tCrMuHxg at public.gmane.org
Wed Aug 26 17:45:18 EDT 2009


Hi all,

I'm writing a bash script which I would like to execute the same script 
on a linux and a solaris system. but my problem is that the bash 
executable is in /usr on linux and /usr/bin on solaris. So how do I 
define the first line #! syntax so that the shell which is executing the 
script knows where to pick up the executable.

For example, the syntax of my simple script under linux would be

#!/bin/bash
echo Hello World

and under solaris would be

#!/usr/bin/bash
echo Hello World

I remember some syntax which would tell the system running the script to 
look in the path for the shell executable, but I can't remember the 
syntax and I'm having a hard time finding it searching google. Does 
anyone know the best solution?

Thanks in advance. Steve.






More information about the Discuss mailing list