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

Print the 10th line without using tail and head command.

1934


What does $1 mean in bash?

805


What is scripting autism?

896


What is wc in shell script?

721


Write a command sequence to find the count of each word?

723


How do I run a powershell script?

766


What is the syntax of while loop in shell scripting?

763


What are script files?

715


What is awk in shell script?

936


Why are shell scripts used?

804


What is meant by dos operating system?

789


What is the difference between break and continue commands?

773


What is subshell?

683


What is a shell made of?

726


Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.

794