Shell Scripting-4

Shell Scripting-4

·

1 min read

Table of contents

No heading

No headings in the article.

for loop

for loop in 1 to 5

while loop

vi whileloop.sh

# try to keep any number at 5

output

switch case

instead of using nested if else we can use switch case

vi switchcase.sh

output

vi switchcase2.sh

output

functions

vi function.sh

output

vi utilities. sh (one shell script is taking the help of other shell script information

vi a.sh

output

Shell input and output redirection

Input Redirection – Using input redirection a user can redirect the input of a command from a file. The less than character (<) is used to redirect the input of a command in Linux shell scripting. The syntax that is used for input redirection is shown below

$ command < file_name

Output Redirection – Using output redirection a user can redirect the output of a command into a file. The greater than character (>) is used to redirect the output of a command in Linux shell scripting. The syntax that is used for output redirection is shown below

$ command > file_name