> #!bin/sh
might be a typo, is probably:
#!/bin/sh
Main Topics
Browse All Topics
hi
i am newbie to linux shell programming
i have seen many shell programs in which
its starts
#!bin/sh
can u tell me what exactly this statement means & why it has to be used
Tushar
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
When you run a command the OS doesn't immediately know whether the file being run is a script or a binary file. The OS only knows that it is an executable file. The first thing the OS does is read the first few bytes of the file. If it starts with the four bytes "\177ELF", then the OS knows that this executable file is an ELF binary file, and begins the process of executing it. If it starts with the two bytes "#!" then the OS knows that it is dealing with an interpreted script file, and that the rest of the first line contains the name of the program it should use to interpret the program.
So, if you have a /bin/sh script file called myScript, and you try to run it:
1. The OS reads the first few bytes of the file.
2. The OS recogizes them as #!, the script indicator.
3. The OS reads the rest of the first line, namely "/bin/sh"
4. The OS runs the command "/bin/sh myScript"
5. The bourne shell interpreter "/bin/sh" starts up
6. /bin/sh realizes that its first argument is "myScript"
7. /bin/sh opens up and begins to read "myScript"
8. /bin/sh runs the commands found in "myScript"
You can take advantage of this and do some weird things. If you create a script file containing this line:
#!/bin/ls -l
Then when you run it, it performs an "ls -l" on itself.
If you create a script with:
#!/bin/cat
Then you have created a minimal script which outputs itself!
Business Accounts
Answer for Membership
by: brunomsilvaPosted on 2004-06-07 at 08:46:25ID: 11250494
hi,
the first line of the shell script is used to say where the interpreter of that script will be, for example
#!/usr/bin/perl says that this file will be interpreted by perl which is in /usr/bin