answersLogoWhite

0


Best Answer

It can depend on which shell environment you are using, but what I use is:

function something

{

# body of routine

}

# call the function

something

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write functions in Linux shell scripting?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write function integerpower that return the value of base exponent?

write a scripting to return values in functions


How do you write a statement in DOS using shell script to display a word?

We can not perform Shell Scripting in DOS, we can do Batch programing in DOS..


Where can someone go to learn more about shell script?

Linux shell scripting tutorials are available as pdf files or videos where a lecturer speaks over a video of a computer console. This is where you can watch someone code in the bash environment and follow along.


How do you add two matrices using Linux shell script?

write ashell script to add awo matrix using array.


When might it be necessary or advisable to write a shell script instead of a shell function?

A shell function will do nothing unless it is explicitly called by other code, typically in a shell script. A shell script is a runnable, executable process, which can call other shell scripts and/or functions. The question might be worded backwards - it is necessary to write shell functions for shell scripts when certain logical functionality is required to be performed multiple times. Consider a shell function equivalent to a program subroutine - they operate the same way.


What languages can be used to write server side scripting in ASPNET?

java


Could you tell me how to write a script that verify that I am the root user in Linux?

You don't need a shell script for this; just use the 'id' command look at the uid, which for root is 0.


Can you write multiple scripting languages in a single page?

Yes. In fact this is fairly common. For example, using in the same web page a client scripting language such as JavaScript and a Server Scripting Language, such as ASP.NET or PHP.


Write a Linux shall script to shift all characters in a file forwarding five characters ie 'a' become 'f'?

A shell script is not necessary for this solution. See related link for answer.


Where can one read a guide on bash scripting?

Bash scripting is one of the easiest types of scripting to learn. Bash is very flexible, and has many advanced features. Bash is not only used to run programs but it also used to write scripts.


Which language can be used to write server side scripting in ASPNET?

c# AND VB AND C++


How do you write shell scripting in UNIX?

A shell script is nothing more than a readable and executable ASCII text file. In this file you put all of the commands that you want to execute, in sequence. The name of the file can be anything you like. Any text editor (VI, VIM, pico, etc) can create a shell script file In addition, shell script files have the ability to detect logic, and are programmable. Just think about what tasks you want to perform and their order, and put it into a file, and there you have a shell script.