Reputation: 13
I want to learn shell scripting and I will use solaris in my work. Is there any difference between shell scripts on linux and shell scripts on solaris?
Upvotes: 0
Views: 1365
Reputation: 13
thank you all. What I understood from your replies that I have to learn the bash shell which is compatible with linux and solaris.
Upvotes: 0
Reputation: 14800
The difference is not between Linux and Solaris, the difference is between which shell you are using on each: sh, csh, ksh, zsh, bash etc.
When you write a shell script you should always start it with a shebang indicating what shell the script is written for. For example
#!/bin/bash
or
#!/bin/csh
Note shebang also works for scripting in non-shell languages:
#!/usr/bin/perl
#!/usr/bin/python
The bash
shell is now commonly available nearly everywhere, and I suggest that's the one you learn if it's available on you Solaris system.
/bin/sh
is the POSIX shell and you should learn that, and the differences between it and bash.
ksh
is an improvement over sh
, as is zsh
(but zsh claims it "is a shell designed for interactive use")
csh
is considered evil
These days bash and sh are the ones to learn.
Upvotes: 3