study24x7
Scripts
  • Followers
  • Latest Feeds
  • Question
  • Course
  • About
  • Review
Interests
Scripts

Use of square brackets is necessary in bash for if statements.
The basic syntax of if..then statement is:

#!/bin/bash
if [ condition ]
then
<commands>
fi

If you have many if statements(nested if) inside your script,then with proper indenting syntax is:

#!/bin/bash
if [ condition ]
then
<commands>
if [ condition ]
then
<commands>
fi
fi

study24x7
Write a comment

A shell script contains a sequence of commands for a UNIX-based operating system. It's called a shell script because it combines into a "script" in a single file a sequence of commands that would otherwise have to be presented to the system from a keyboard one at a time.Thus , a very useful tool in automating tasks in Linux OSes. All scripts can be run without the need of compiling it, so the user will have a way of prototyping commands seamlessly.
The bash (Bourne-Again Shell) is the default shell in most of the Linux distributions and OS X. It was developed by Brian Fox and was released in 1989.
Every Linux script starts with a shebang (#!) line. The bang line specifies the full path /bin/bash of the command interpreter that will be used to run the script.

study24x7
Write a comment
About
Ratings
5.0
out of 5
1 Ratings
5 study24x7
 
1.0
4 study24x7
 
0.0
3 study24x7
 
0.0
2 study24x7
 
0.0
1 study24x7
 
0.0
Related Pages

ENGINEERING DESIGN

17 followers

Dr Jayant K Singh

19 followers

Learn Tech

61 followers

Learn Advance REASON..

103 followers

Prof S D Agashe

16 followers

aman pandey

84 followers

Learn N Share - Get ..

253 followers

Prof K L Sebastian

10 followers

Prof T V Prabhakar

9 followers

V5 Institute

137 followers

Prof Samik Nanda

9 followers

Prof V Balakrishnan ..

49 followers

Reasoning with Rizwa..

112 followers

Prof Parasuraman S

10 followers

Prof Debasish Ghose

7 followers

Prof. C. Balaj

9 followers

Prof. T.V. Ramachand..

20 followers

PROF. C. BALAJI

8 followers

Prof. S. Dasgupta

22 followers

Prof. Amitabha Ghosh..

3 followers

GSGURUMANTRA

138 followers

Maths By Uttam Sir

127 followers