LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 06-25-2009, 10:59 AM   #1
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Rep: Reputation: 70
Question What language is this?


Hi guys,

Can anyone tell me which language this script is written in? Thanks!


if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi

if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi

umask 022
 
Old 06-25-2009, 11:01 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Bash.
 
Old 06-25-2009, 11:07 AM   #3
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by Nylex View Post
Bash.
Bash is itself a language?? What's it based on?
 
Old 06-25-2009, 11:09 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Bash, the shell has its own language, yes. Most (all?) shells have their own language, or use the language of another shell. As far as what is it based on, I don't know to be honest.
 
Old 06-25-2009, 11:14 AM   #5
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
Talking

Quote:
Originally Posted by Nylex View Post
Bash, the shell has its own language, yes. Most (all?) shells have their own language, or use the language of another shell. As far as what is it based on, I don't know to be honest.
Thanks for disabusing me of my ignorance!
 
Old 06-25-2009, 11:18 AM   #6
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by Nylex View Post
As far as what is it based on, I don't know to be honest.
It's based on the Bourne Shell (/bin/sh), hence Bourne-Again SHell (geddit?! ).

The Bourne Shell was in turn based the Thompson Shell, which was the first UNIX shell.

Follow the wikipedia links from bash for more info.
 
Old 06-25-2009, 11:23 AM   #7
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by pwc101 View Post
It's based on the Bourne Shell (/bin/sh), hence Bourne-Again SHell (geddit?! ).

The Bourne Shell was in turn based the Thompson Shell, which was the first UNIX shell.

Follow the wikipedia links from bash for more info.
Yeah, I remembered that not long after I posted .
 
Old 06-25-2009, 11:59 AM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
lol, your name is so ... appropriate
 
Old 06-26-2009, 06:09 PM   #9
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You are yet to discover the power of *nix. Bash is a shell accepting commands. Every command you issue you can put in a shell script and execute it. (Just like dos.bat files)

But the other way around, you can use any command from a script in your shell. Say you enter this in your console:
Code:
function foo{
 echo $1
}
That looks purely like a program, doesn't it? Enter it on your command line.
Call:
Code:
foo bar
and see that this function get executed.

jlinkels
 
Old 06-26-2009, 06:44 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Digressing further into the weeds.....

What was the first instance of using a word command to control a computer? (Not counting things like assembler.)
 
Old 07-06-2009, 08:42 AM   #11
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
Talking

Quote:
Originally Posted by pixellany View Post
Digressing further into the weeds.....

What was the first instance of using a word command to control a computer? (Not counting things like assembler.)
Okay, well clearly no one knows and it's not as if I have any 'guru' rep to lose, so what's the answer?

BTW, I am now up to page 200 of the Bash Shell-Scripting Bible (Wiley) and nowhere yet can I find anything to state that Bash is anything other than one of a number of shells. Not calling you guys liars of course - I'm happy to accept it's a language as well - but just just excusing my ignorance. ;-)
 
Old 07-06-2009, 08:44 AM   #12
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
Wink

Quote:
Originally Posted by H_TeXMeX_H View Post
lol, your name is so ... appropriate
Which is why I chose it! BTW, if you're 220lbs+, you're screen name is totally apposite, too.
 
Old 07-06-2009, 09:04 AM   #13
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by Completely Clueless View Post
Which is why I chose it! BTW, if you're 220lbs+, you're screen name is totally apposite, too.
lol, well actually I'm quite light, more like 145 or so.

Actually, I'm not sure what causes most people to be so fat in Texas. I had lots of geek friends who were as skinny as I was, and they never got fat.
 
Old 07-06-2009, 11:26 AM   #14
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by Completely Clueless View Post
BTW, I am now up to page 200 of the Bash Shell-Scripting Bible (Wiley) and nowhere yet can I find anything to state that Bash is anything other than one of a number of shells.
A shell consists of two parts, the command interpreter and the part which forks and executes a program.

The command interpreter is an interpreter (duh!) and the language it interpretes is the Bash scripting language. Although it may sound strange given the sometimes crooked syntax constructs, there exists a formal language description for the Bash language.

jlinkels
 
Old 07-06-2009, 11:36 AM   #15
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
Quote:
Originally Posted by pixellany View Post
Digressing further into the weeds.....

What was the first instance of using a word command to control a computer? (Not counting things like assembler.)
When God said "Let there be light"?

To the OP: Bash is a command interpreter. The commands it understands have to follow a certain syntax. The commands and the syntax form a language.
 
  


Reply



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
Good linux chinese language language program? darsunt Linux - Software 1 04-10-2009 12:06 PM
language chaos111 Slackware 2 02-23-2006 06:30 AM
D language greg108 Programming 33 11-18-2004 08:53 AM
Which language? rooman Programming 4 10-21-2004 08:11 PM
Second language quietguy47 General 45 10-15-2003 02:02 AM

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

All times are GMT -5. The time now is 04:03 AM.

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
Open Source Consulting | Domain Registration