Use the return command to end the function, and return the supplied value to the calling section of the shell script.Use the exit command to end the shell script.Change the state of a variable or variables.It is generally accepted that in shell scripts they are called functions.Ī function may return a value in one of four different ways: A shell function may do neither, either or both. A procedure, on the other hand, does not return a value, but Is traditionally that it returns a single value, and does not outputĪnything. Procedures or functions the definition of a function There could be some confusion about whether to call shell functions library.shgoes at the start of the script. The second (library) method is basically the same, except The method is the same however it is done we will primarily be using The start of the other scripts which use the functions. However, when writing a suite of scripts, it is often easier to writeĪ "library" of useful functions, and source that file at Is simply declared in the same file as it is called. Generally done in one of two ways with a simple script, the function You can easily write functions for use within your script. One often-overlooked feature of Bourne shell script programming is that
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |