Bash is a Unix shell and command language which is commonly used for system administration tasks whereas Python/Perl/Ruby is used for general-purpose programming. But all of these can handle all kind of problems and all have different strengths over the rest.
Bash shell scripting comes into account if you need to run an entire script/commands without a single Linux command. The bash commands are commonly used for system administration tasks.
If you want to write a program which creates a directory with a specific name
Our script can be as follows,
.echo “Enter name of directory”
.#echo is used to display content on
.#the name of
.#mkdir creates the respective directory.
These commands for instance echo, touch can be used as individual commands in Linux. But if you need to run an entire script of commands bash scripting is used.
The language Python can be used for any programming task especially from GUI programming to web programming ( Data Analysis, Game Development, browser automation etc). It’s quite efficient, it is done at the C level that means the Python is a layer on top of C.
For instance, we are going to create a simple CGI program. Most of the Linux web server is configured to run the scripts in the -bin directory in /var/www. Here we are going to specify a directory to run our CGI scripts. For that, comment the following lines in the .conf file on your web server.
Allow from all
Here we are creating a sample CGI script /var/www/-bin directory and following scripting commands, please make sure that the file has the execution permission.
print ‘<title> Hi Word! sample CGI program for you </title>’
print ‘<h2>Hi Word! sample CGI program for you</h2>’
Once you click on, you see the following output
Hi Word! sample CGI program for you
Perl is used for creating gaming, multimedia etc. And it is used for grepping information from a text file and pulling into another form. It has a number of tools/modules for complicated program’s or problems, (including all systems programming).
The execution of a Perl script will use more system resource usages. But writing in Perl instead of C will save your time.
# Prints the message using two different delimiters.
print “Hello, world!\n”;
print qq=Did you say “Hello?”\n=;
The Ruby is a web framework programming language, Ruby and Python are visually similar but are different in solving problems.
” margin_top=”50px” margin_bottom=”” animation_type=”slide” animation_direction=”left” animation_speed=”0.3″ class=”” id=””]