How to declare functions in unix shell script?

Answer Posted / sujay kumar

First method:

function function_name
{
}

Second Method:

function_name()
{
}

For both methods, the invocation of function would be in
the same format only.

Invocation:

function_name

Is This Answer Correct ?    62 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between ‘ and ” quotes.

617


What can you do with powershell?

613


How do I open the shell prompt?

577


How do I run a powershell script?

579


What does .sh file contain?

557






What is the first line in every perl script called?

559


‎What is a shell? · ‎Types of shell · ‎what is shell scripting?

556


Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.

1857


Is shell scripting a programming language?

579


How to print all array elements and their respective indexes?

512


How can I send a mail with a compressed file as an attachment?

558


Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.

2176


Write a script to print the first 10 elements of fibonacci series.

1772


What is scripting used for?

566


What is shell geeksforgeeks?

600