ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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:
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. ;-)
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by Completely Clueless
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.