Study On Bash Programming And Unix Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

UNIX includes a family of computer operating systems developed at Bell Laboratories.[1] UNIX manages the resources of the computing environment as processes of management, hierarchical file systems and other special functions. The commands used can control data management, editors, assemblers, compilers and text formatters. These formatters are made available to users via a command language that provides the interface between user and the UNIX operating system. In the UNIX operating system, the shell is a program that runs operating system commands. This program is called the Shell and programs written in this language are sometimes referred to as Shell scripts, and these execute commands, read either from a terminal or from a file. Shell commands may be created, allowing users to build their own commands. A shell program handles the interaction between you; the user, and the computer. The shell scripts have a huge set of commands and utility programs offering a vast range of facilities, used for directory management, file processing, text editing and messaging etc. The first UNIX shell was the developed by Steven R. Bourne.The Bourne shell program name is sh and the first sh was written by Steve Bourne in 1978.

The shell is also command interpreter and a programming language. When you type a command, you are working within a shell program, in UNIX, which intercepts everything you type and checks to see that it is a meaningful command it can perform. The shell also contains its own programming language. Bash is the shell, or command language translator, for the UNIX operating system. Shells give opportunities including job control, command line editing, and command history. Each of these features are described in this manual. In standard Unix operating system, dollar sign ( $ ) icon ordinary to most shells. Bourne shell was developed as part of the GNU project. The shell call Bash (Bourne Again Shell) in Linux operating systems. We have advantage with shell programming, if a user need better capabilities, the user could write own script to provide those capabilities and speed.

Most Unix based operating systems provide bash, which has the standard shell. The GNU project was started by the Free Software Foundation for creating a free version of UNIX. The main libraries , compilers and commands are a part of the GNU project. The shell provides to use the rich set of GNU utilities. Perl, Ksh, and Python are similar, but not the same as Bash. The Korn shell (ksh) is an developed version of the Bourne shell. Korn shell is a popular shell on many Unix systems and the Korn shell's features work under Bash. Python is a programming language , it is designed for small projects. It is not a shell like Bash, but it contains many features. Python scripts are not suitable with bash.

Imperative and declarative are usual methods in programming. Imperative programming is using by programmers for day-to-day jobs. For Imperative Programming, the name comes from programming languages like C++, C , Fortran, COBOL, etc. In Imperative programming, you write the special code with details for what to do but in Declarative programming this situation is the opposite of the imperative programming because of the difference. You can do declarative programming without giving special details of how the actions are performed.

Imperative programming was named based on imperative mood used in natural languages. In 1950s, imperative programming has been started with FORTRAN. Fortran is an imperative programming language. Fortran was developed in IBM Corporation and IBM used for scientific and engineering research. In Fortran, numerical programming is used. The other thing is easy portability and it isn't necessary to know any programming language. FORTRAN is not compatible with some LEDS. After that FORTRAN was designed again and the updated name is FORTRAN 77.

On the other hand, imperative programming has more than one programming language such as BASIC and C. BASIC an acronym of Beginner's All-purpose Symbolic Instruction Code. The first BASIC (Dartmouth) was designed in 1964 for non-science student's need to access computers. BASIC programming language is still popular today, some programming languages use base of BASIC such as Visual Basic. BASIC is easy to learn because BASIC first used for personal computer with the simple programming language. In 1960's , computers were huge, slow and very expensive, and because of that, groups of undergraduate students invented easy and accessible computer like a desktop. BASIC sharply grew in response to the needs of its users.

In addition , BASIC has no patent or copyright. Programmers are free to change its source code and develop it by self. BASIC also used by some companies like General Electric. First, General Electric Corporation used BASIC with unchanged version(first version). After that, they added some special features and they called GE BASIC.

The C programming language is the de facto standard for writing microprocessor systems software and C is the Unix programming language. Most Unix application software is written in this language. Although C was designed for system software, now it is also being used for application softwares such as C++ . The C programming language was influenced by B, ALGOL, PL/I and FORTRAN. The use of C has become a popular development language for a range of other operating systems such as Pc or MS/DOS operating system. Now, there are more than 20 different compilers available for C.

Declarative programming is about statements of work without special arguments such as logic or the algorithm. Regular expressions, logic programming and functional programming included in declarative programming. In Declarative programming we don't have to describe what computation performs or how to compute it. We can divide declarative programming into five groups; Constraint programming, Domain-specific languages, Functional programming, Hybrid languages, and Logic programming. Domain-specific is a markup languages such as HTML, CSS, XML and SQL (database system).

Certainly, as far as these programmers are concerned, portability and fast development is important. One another important factor is industry standard because software developers are looking for compatibility programming language between machines and compilers.

The bash shell is a fully changeable shell with many advanced features, including: job control, filename completion, command history. In the bash, the use of a high level language compiler is not necessary for shell scripting. Generally, shell scripts execute faster than others. The Bash supports a number of suitable features and the ability to change groups of files with a single command. The bash makes command entry easier and its giving the user more flexibility in controlling UNIX operating system. (Groff 1983).The standard UNIX operating system comes with over two hundred utility programs. Applications are started in the same way as the UNIX utilities. The user gives command the name of the program in command line, and the shell executes after that (Groff 1983).

The Bash also includes the following main features:

' A commonly used sequence of shell commands can be stored in a file. The script file can be used to execute with a single command.

' The user can control the behaviour of the shell, as well as other programs and tools.

' The shell includes some programming languages. These features can be used to build shell scripts.

' Time consuming, noninteractive task can proceed while the user continues with other interactive processing.

' The Shell communication between the user and the UNIX system takes the command with the shell

On the other hand, shell has a slow execution speed and the need to launch a new process for each shell command.

The bash system shell is the most widely used on UNIX systems. The bash provides a history feature that remembers what commands we have previously entered, computer saved our history feature in a hidden file in our home directory and the entire list are viewed when we type history. Another useful command feature is Tab key, when we are typing command, bash will try and guess what we trying to write. If we have not typed enough of a word, a second press of the Tab key will show a list of possible commands for us. Bash has two editing modes; Vi mode such as vi and vim editors. Emacs mode works like emacs, nano or pico.

The most usual keys listed below;

Key or key combination Function

Left arrow --- moves back opne character to the left.

Right arrow ---- moves forward one character to the right.

Up arrow---- moves to previous command in the command history

Down arrow---- moves to the next command in the command history

Control-C Ending a running program and returning the prompt

Control- D Log out of the current shell

Control -H Generate backspace character

Control ' L clearing the terminal

Control-Z Suspending a program

The vi mode key combinations are follows:

Esc Enter/exist editing mode

H moves back one character to the left

L moves forward one character to the right.

Esc twice Finds a matching filename and completes it if there is one exact match.

These default key combinations can be changed with using the bind command. Bind command is using for managing keyboard mappings

CLI's (command line interface) are user interfaces of a computer's operating system in which the user responds to a prompt by typing in a command and then gets a response from the operating system. They are also called a command line shell, command language interpreter, or CLI. CLIs are used by system administrators, programmers and personal computer users, we can also use in scientific environments and engineering (e.g. MATLAB).

When we type acceptable commands into the command line, the computer executes commands and provides textual display of results or error messages. In the command line you can perform editing commands before you press ENTER. The editing capabilities provide a way to correct mistakes made when typing in a command. We can erase the character in the command line with backspace or DEL keys. We can use the up arrow key to redisplay our last command. These commands are helpful for us. However, there are differences between the CLIs of these operating systems. (Picture 1a, 1b)

The text based command line interface first used in some device in 1960s, this devices like the ASR-33 Teletype, CRT-based computer terminals (etc. VT52). These devices were generally text based; they don't have any ability like a graphical user interface. In 1970s, the Unix operating system created and the Unix operating systems were including a powerful command line environment, which Unix called the shell.

Most users prefer the graphical user interface (GUI) offered by MacOS, Windows, and others. Actually, most of today's UNIX-based systems and applications provide both of them (CLI and GUI). There is clear difference between Unix and Windows because of Windows has different command system which is licensed and developed by Microsoft and the costumer must pay to install on their own system. However, in UNIX, the command system can be altered and can be redesigned by the user and it is an open source operating system. This also means that the two operating systems are not convertible. A program written on Windows cannot be run on Unix and it is same for Unix

Today, many business companies prefer to use command line software. This is because the command line based software makes for easier administration, useful and CLI uses less computer resources. On the other hand, the Unix operating system is more secure than the Windows because Windows is more commonly used and therefore contains more viruses, malwares, spywares etc.

In general, there are two differences between shell scripts and other programs. Shells are designed simple and short tasks.

A graphical user interface uses computer pictures and symbols with a keyboard and mouse because mouse to enable users interact with operating system. A GUI provides an easy use interface to a program. A graphical user interface provides also windows, some menus, scrollbars, wizards, some other icons.