- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- script reference
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 01:36 PM
11-22-2005 01:36 PM
1) May I know any website that I can refer to learn the basic of shell script?
2) As I know, there are many types of script exp: korn shell, bourne shell, c, posix, pearl and etc. What is the main different for these script? Only different in syntax? If there is a scipt, how to determine what type of script being used?
regards.
regards
Solved! Go to Solution.
- Tags:
- shells
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 02:28 PM
11-22-2005 02:28 PM
Re: script reference
http://www.dartmouth.edu/~rc/classes/ksh/print_pages.shtml
What scripting language you use depends on what you want to accomplish. 'Normal' shell scripts written for korn, bourne, c, posix and bash are generally useful on every *nix system since they all have at least one of these shells already installed.
korn, posix and bash are (I think) about 99% compatible and a superset of the bourne shell. So bash or POSIX shell would be a good place to start with.
If you want to create more complex administration tools or want to start CGI scripting, you can also have a look at PERL or Python.
Usually a script written for a certain shell starts with a '#!
I recommend starting out with standard shell scripting before getting into PERL or Python though.
Hope this helps,
Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 07:09 PM
11-22-2005 07:09 PM
Re: script reference
http://mercury.chem.pitt.edu/~sasha/LinuxFocus/English/September2001/article216.shtml
http://vertigo.hsrl.rutgers.edu/ug/shell_help.html
http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Unix/CShellII.html
2) Shell scripting is differing based on supported operation and syntax. To determine the shell script type then,
open the script file with editor or cat
see the first line of #!
That shell inclusion is saying the shell type. You can use file <script> to know the shell type.
Difference between shell scripting is as,
http://www.softlab.ece.ntua.gr/facilities/documentation/unix/shelldiff.html#5
http://www.unix.com/archive/index.php/t-12274.html
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 07:53 PM
11-22-2005 07:53 PM
Re: script reference
http://www.emu.edu.tr/english/facilitiesservices/computercenter/bookslib/
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 08:48 PM
11-22-2005 08:48 PM
Re: script reference
Thanks for your reply.
When I create a new user thru SAM, the Start-up Program that I choose is /usr/bin/sh. This means bourne shell, right? Can this user write a script without the heading like #!
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 09:31 PM
11-22-2005 09:31 PM
Re: script reference
/usr/bin/sh is POSIX shell which is default on HPUX.
/usr/old/bin/sh is bourne shell.
If you would like you use default shell then you don't have to specify starting line as #!/usr/bin/sh it will be POSIX by defualt.
If the use wants to use different shell other than POSIx then he need to mention the same in the first line of his script as:
#!/usr/bin/ksh
This will use korne shell.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 09:32 PM
11-22-2005 09:32 PM
Re: script reference
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 11:29 PM
11-22-2005 11:29 PM
Re: script reference
If you haven't already noticed, the standard shell for HP-UX users is '/usr/bin/sh', whereas the REQUIRED shell for root is /sbin/sh'.
THe difference is that '/usr/bin/sh' has been compiled with dynamic link libraries whereas '/sbin/sh' uses only static ones.
NEVER change root's shell. The '/usr' filesystem isn't mounted during the early stages of system startup and any shell that needs needs the dynamic libraries therein would not be able to link to them. If you did this for the root user, you would find that your system was unbootable.
Use the '/usr/bin/sh' for all other non-root users. Using the dynamically linked, shared libraries provides a better memory footprint than having the static structure of '/sbin/sh'.
As already, noted, both '/sbin/sh' and '/usr/bin/sh' are POSIX shells. The old Bourne shell lives as '/usr/old/bin/sh'. You also have '/usr/bin/ksh' which is Korn88 and '/usr/dt/bin/dtksh' which is Korn93. A '/usr/bin/csh' shell is also available.
A very good site for shell scripts and tips is:
http://www.shelldorado.com/
A guide to shells can be found here:
http://docs.hp.com/en/B2355-90046/index.html
All shell scripts start with a declaration of the shell interpreter, clearly identifing the shell in use, like this:
#!/usr/bin/sh
#!/usr/bin/ksh
#!/usr/dt/bin/dtksh
Regards!
...JRF...
- Tags:
- shelldorado
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2005 12:23 PM
11-23-2005 12:23 PM
Re: script reference
I hv gone thru HP guide book on shell and found below table:
Table 1-2. Shell File Names and Default Prompts
Shell File Name Prompt
Bourne /bin/sh
POSIX /bin/posix/sh
Korn /bin/ksh
Key /usr/bin/keysh
C /bin/csh
Restricted Bourne /bin/rsh
Restricted Korn /bin/rksh
1) By default, all HP servers shell is POSIX, right? I think POSIX shell is /bin/sh. But why the above statement mentioned the POSIX is /bin/posix/sh?
2) By default, what is the shell that come together with the HP machine?
3) What is the shell name for bash, tcsh, zsh, rc and es? How about the shell name for pearl script?
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2005 01:53 PM
11-23-2005 01:53 PM
Solution1A. Yes, by default, the standard HP-UX shell is the POSIX shell -- either '/usr/bin/sh' for non-root users or '/sbin/sh' for the root. Please re-read my first response, above, for more details and the importance of maintaining this relationship.
1B. The '/bin' path, as in '/bin/sh' translates to the path '/usr/bin'. '/bin' is known as a "transition link". It arises at the time HP-UX 10.0 was released. At that time, the filesystems were reorganized into what you presently see. The model adopted paralleled AT&T SVR4 UNIX.
If you are interested in more of the details, see the "HP-UX 10.0 File System Layout White Paper" here:
http://www.docs.hp.com/en/5963-8942/index.html
While transition links still exist, you are STRONGLY encouraged NOT to use them, Thus, instead of coding '/bin' you should write '/usr/bin'. Transition links will disappear eventually.
2. As noted, while the standard shell is the POSIX shell; there is also the Korn shell (/usr/bin/ksh & /usr/dt/bin/dtksh for Korn-88 and Korn-93 implementations); and the C-shell (/usr/bin/csh) available as standard HP-UX shells. The very, old, Bourne shell can still be found as '/usr/old/bin/sh' but is virtually useless.
3. Other shells have been ported to HP-UX. The "Boune-Again_Shell" ('bash') is one popular one. Generally, these, and others often would be installed in '/usr/bin'. Exactly where they live matters less than the fact that the scripts that use them would declare their interpreter with the "she-bank" sequence -- "#!/usr/bin/bash" for instance, to tell that the script is a 'bash' shell script. The "she-bang" characters (#!) tell the kernel that what follows is the interpreter, or program to use.
Perl is far, far more than a shell language. It is an extremely powerful programming language which draws from the C language, the shell, 'awk' and 'sed'. It has one of the most powerful regular expression engines of any language available. It is generally loaded in '/usr/bin' or in '/opt'. Regardless of where it lives, a perl program also begins with something like "#!/usr/bin/perl" to declare that the program that follows is perl and where to find the perl executables. You can scratch the surface by starting your exploration here, for example:
http://www.perl.org/
Regards!
...JRF...