| New Reply |
What is bash in unix/linux/ubuntu? |
Share Thread |
| Jan16-13, 12:30 AM | #1 |
|
|
What is bash in unix/linux/ubuntu?
Desktop is the graphical way to interact with the OS right?
So similarly is bash the textual way to interact with the OS? Then what is bash scripting? Can we program bash? I don't really understand what bash is actually |
| Jan16-13, 12:43 AM | #2 |
|
Mentor
|
#!/bin/sh at the beginning. The exact form depends on exactly where the shell is installed, which depends on your version of Unix or Linux. |
| Jan16-13, 02:30 AM | #3 |
|
|
|
| Jan16-13, 02:36 AM | #4 |
|
Admin
|
What is bash in unix/linux/ubuntu?
To approach it from a slightly different direction, shell (and as jtbell already wrote, bash is a shell, actually bash stands for Bourne-again shell) is a program that takes input from your keyboard and executes it (either directly, or running other programs). Scripting means instead of typing series of commands one by one from the keyboard you put them in a single text file - and shell executes them automatically. This file is what we call a shell script.
|
| Jan16-13, 07:39 AM | #5 |
|
|
But you can also write programs in bash...with the for loops, while loops, if conditions etc.
So bash is more than just textual input and output? |
| Jan16-13, 08:02 AM | #6 |
|
Admin
|
Not sure what you mean by "just textual input and output" but yes, it is more than just a simple command line interpreter like the one known from MS-DOS. In a way it is a programming language.
Note that it is possible to use loops even from command line, for example single line like this one: Code:
while :; do for i in *.avi; do omxplayer $i; done; done |
| Jan17-13, 10:41 AM | #7 |
|
|
Before gui came was terminal/bash like shell the way to communicate with the computer?
And is this the reason why linux users love using terminal as it allows writing code to do something that would be tedious using gui |
| Jan17-13, 11:17 AM | #8 |
|
Admin
|
|
| Jan23-13, 01:00 AM | #9 |
|
|
Why are there 6-7 terminals in ubuntu?
I have noticed that ubuntu has tty1, tty2, tty3, tty4 .....till tty7. |
| Jan23-13, 02:58 AM | #10 |
|
Admin
|
tty0?
With tty0 there would be 8, and 8 is a nice number on computers. But it still looks low to me. In Debian on Raspberry I have 64 terminals. Same on an older that dirt RedHat and and on CentOS that was set up last year. These are just machines I have an access to, no idea what is the standard. |
| Jan23-13, 03:33 AM | #11 |
|
|
One of the reasons is you may want several users to be able to log in simultaneously. Or even just one user have multiple terminals, so they can do something else while a long process is running.
Note that not all these users need to be physically at the computer. If you open a remote session, for example through ssh, you will also be assigned to one of the terminals. |
| Jan27-13, 05:52 AM | #12 |
|
|
The contextual question you should ask is: why don't other operating systems have this.
1. shells like bash enable you you use and program your computer without a GUI. In the old days people just had terminals. Examples of terminals 1.1 Teletypes (antiquated) http://en.wikipedia.org/wiki/Teletype_Model_33 1.2 VT220 http://en.wikipedia.org/wiki/VT220 1.3 http://www.youtube.com/watch?v=T3TifjAX51I PDP 11 computer (probably running Unix) and an LA120 terminal (its a dot matrix printer too) (Unix was a predecessor of linux) 2. you can log multiple times to many versions of Microsoft Windows, just like you can log in multiple times to Ubuntu using the various terminals. In the old days these corresponded to real terminals. 4. In the old days people had terminals, these days people have terminal emulators. A LOT of the way bash and other shells work is based on how these terminals worked. To list the terminals in Ubuntu type 'ls /dev" in the shell. Everything starting with 'pty' is a psuedo teletype, everything starting with 'tty' is a teletype. |
| Feb7-13, 07:38 PM | #13 |
|
|
A shell is just a command-line language; it is a set of commands you can give to the computer's operating system. As other users point out above, there are multiple dialects of shells available, and you can configure your account to use the one you want. 'bash' is just one dialect of shell language.
You use shell commands either in a command window, or if no GUI is running. Windows computers also have a command-line language, similar to shells, but the Windows command-line language is not called a shell; instead, it is now called Power Script. Current versions of Windows tend to have all the same capabilities in their scripting language that Linux shell languages tend to have. System administrators like to use command-line scripts (programs of multiple commands) to automate complex actions that have many parts, even if a GUI is also available. Scripts can also run when the machine is on but a user has not logged in, whereas a GUI will only run for a logged-in user. |
| New Reply |
Similar discussions for: What is bash in unix/linux/ubuntu?
|
||||
| Thread | Forum | Replies | ||
| [ubuntu] Can't boot into anything after installing Ubuntu on Windows 7 | Computers | 2 | ||
| Unix/Linux memory map command | Programming & Comp Sci | 2 | ||
| QT Programming with Debian or Ubuntu Linux - a problem | Programming & Comp Sci | 5 | ||
| Intro to Unix/Linux | Science Textbook Discussion | 2 | ||
| Flex++ in Ubuntu (Linux) | Programming & Comp Sci | 0 | ||