what is shell scripting?
What is shell scripting? what is 'bash'? :study:
|
Hello,
Asked and answered a million times before. Please put in some work and Google, there are so many documents online that go into detail on what shell scripting and Bash is. Kind regards, Eric |
It's God's judgment on humanity. And use a web search like DuckDuckGo.
|
BASH: Bourne Again shell
Bash is a type of shell in Unix/Linux. A shell in Linux/Unix means something which takes as input the user specified commands, executes them and gives us the output. Every command recognized by the shell is actually a program whose executable is stored in the folders like /bin. Example: ls is a command which lists all the files in a folder. So here we are using ls command to list out all the folders in the root directory. (root directory is represented by / in bash, so when we say, /bin, it means the bin directory in the root folder) Code:
anisha@linux-uitj:~> ls / Example: In the below example notice the ls command itself listed inside the /bin folder as an executable. Code:
anisha@linux-uitj:~> cd /bin The commands recognized by the shell usually call dozens of other functions dealing directly with the Linux kernel. It looks too simple??, to know which functions does ls call "internally" to get the list of the files, there is another command named 'strace': The titles which you see in red colour below are actually the functions called by ls, internally. Code:
anisha@linux-uitj:~> strace ls 1. http://tldp.org/LDP/Bash-Beginners-Guide/html/ 2. http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html 3. http://tldp.org/LDP/abs/html/ |
@Anisha: Do you think the OP even can _read_ the script. Heck, I gave up after the second line. I have however bookmarked the page and will read this later.
@OP: Bash scripting is something *nix folks do. It is actually used to scare newbies like you. Hang in there, you would eventually understand. |
Quote:
Quote:
|
Quote:
Sorry to disagree with you but what Anisha posted was in my opinion a very clear and more then complete explanation of what Bash is, and all of that in easy to understand terms. Heck, it's a lot more then what I would post to explain something that's basic knowledge and easy to find on the internet (hence my previous post). Making a statement like you do, bringing down the importance of Bash (and for what it's worth other shells), gives a very wrong image of Linux/Unix. How is OP to understand like you point out he eventually will, when you 'bash' a perfectly good basic explanation? Kind regards, Eric |
kernel and shell
Quote:
http://www.freeos.com/guides/lsst/ :)good luck:) Google "shell scripting" and "bash" without the parentheses |
Eric, thank you, for the soothing words you wrote as a comment in the reputation column. I enjoyed them so much that I was forced to make this post, just to thank you.
|
Hi Anisha,
No thanks necessary, in my opinion you did a great job with that post in very understandable words. Should be appreciated by all newbies looking for a simple explanation of something that can go to very high complexity. Thank you for taking the time to post it. I'm sure a lot of users will agree with me. Statements like SilverBack's one don't add to the valor of Linux at all. Kind regards, Eric |
Document
1 Attachment(s)
here is the pdf "Introduction to bash scripting" this should give you a good foundation along with Anisha's examples
|
Hi citi,
Very nice, thanks for sharing it. I'm sure it'll be of use to someone. Kind regards, Eric |
But it still seems very odd and inappropriate to introduce a newbie to bash using strace...
Anyway, bash is the program that interprets the commands you type at a terminal, and a shell script is a file full of commands that can be run by the shell so you don't have to type them one by one. Like Anisha said, commands are actaully executable programs in certain directories. But some are built into the shell. The shell also has syntax for variables, if-then-else statements, wildcards, math, etc. |
Quote:
I thought it was a nice touch using strace to show that it's not all that simple as just using ls but that there's a 'world' of complex things below what we use on a regular basis. Something about what most newbies don't even think about but can be very useful information. If you want to tame the beast it's best to understand it's nature :) Kind regards, Eric |
Your welcome Eric, just trying to help in any way possible
|
Thanks to anisha and citi!
|
Quote:
|
Nice explanations by anisha kaul and erictra. Especially for the people like me who has come from a poor "English" background. Highly appreciate the way anisha kaul explained.
There are so many people in this world, who dont know english but has a very good technical skills or interest in linux. I am also one of them. For those guys, this google and man pages does not gives the explanation what they want, but when they post in such a forums, they believe that they may get the information in the way they want. I knew that man pages has almost all the informations. But we are not up to that mark to understand its content. Personally i struggled a lot to understand these man pages and sometimes google too gave the same. Now it has been changed (or i have changed my mentality to read man pages) I have been started using LINUX since the beginning of 2008 and i had some idea now. So, Let me complete like this, whenever someone explains like how anisha kaul did, i feel really happy and it increases the confident of approaching this forum and even expecting the answers from the same user who solved/replied to my post last time. |
Sorry if my post seemed so negative. I did not intend it to be that way. The OP was asking for something that could not have been answered/understood in a single post. This kind of knowldge and skills takes time to master. All I wanted to convey to the OP was that he should give himself time (read scripts etc) so that he could understand shells more.
BTW: Anisha you _did_ explain in one post what bash is. Hats off to you for that. |
All times are GMT -5. The time now is 10:00 AM. |