LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-05-2004, 06:33 AM   #1
subaruwrx
Member
 
Registered: Mar 2004
Distribution: Ubuntu Feisty
Posts: 641

Rep: Reputation: 30
What is /bin/bash for?


as above, thanx
 
Old 07-05-2004, 06:38 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
/bin/bash is the executable for the Bourne Again SHell - the shell is the thing that interprets your commands in the terminal and passes them on to the computer. So it's for talking to the computer to tell it to delete files, list directories, install software, run programs, etc.

John
 
Old 07-05-2004, 11:40 AM   #3
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 48
http://tldp.org/guides.html

read these:
Bash Guide for Beginners
Advanced Bash-Scripting Guide
 
Old 07-06-2004, 05:30 AM   #4
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
Hi

and if you are asking what is the
Code:
#!/bin/bash
line found at the first line of a lot of scripts... then the answer is this is the way you specify which is the program you are going to execute the script with.

You can find too at the beginning of some scripts:
#!/bin/perl
#!/bin/python
....

bye.
 
Old 07-06-2004, 02:50 PM   #5
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
The she-bang "#!" is a magic number. When any shell tries to 'run' a file it looks for a magic number, this is how it knows it's dealing with a compiled program, for instance. Check out /usr/include/magic.h ...
which usually points to /usr/include/sys/magic.h
 
Old 07-06-2004, 04:24 PM   #6
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
iirc, it's the kernel that interprets the #!, not the shell. Thus, you can execve() a shell script from your C program just like you would an executable.
 
Old 07-09-2004, 04:01 AM   #7
subaruwrx
Member
 
Registered: Mar 2004
Distribution: Ubuntu Feisty
Posts: 641

Original Poster
Rep: Reputation: 30
Oh, so when adding new user there is also this option to specify the shell right? By default is the /bin/bash?

Am I right to say that /bin/bash is one of many shells available in linux? Different shells will have some different type of commands?
 
Old 07-09-2004, 05:49 AM   #8
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
You are right.

bash is the usual (and default) shell used in linux. You can find too sh, csh, ksh...

The commands are the same more or less. The shells' behaviours are different.

bye.
 
Old 07-09-2004, 06:00 AM   #9
subaruwrx
Member
 
Registered: Mar 2004
Distribution: Ubuntu Feisty
Posts: 641

Original Poster
Rep: Reputation: 30
thanx
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when starting up snort: bash:!/bin/sh/usr/local/bin/snort :Eent not found cynthia_thomas Linux - Software 1 11-11-2005 03:59 PM
What is the difference between #!/bin/bash and #!/bin/sh? mTorbin Linux - Newbie 5 11-09-2005 01:10 PM
Change /bin/bash to /bin/zsh Smokey Slackware 12 07-14-2004 02:06 AM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 07:42 PM
bin/bash:usr/bin/lpr NO SUCH FILE OR DIRECTORY Adibe_Hamm Linux - Newbie 3 10-14-2003 03:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration