O'Reilly logo

Mastering Linux Shell Scripting, by Andrew Mallett, Mokhtar Ebrahim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Passing parameters to functions

Earlier within this chapter, we referred to functions as scripts within scripts and we will still maintain that analogy. Similar to how a script can have input parameters, we can create functions that also accept parameters that can make their operation less static. Before we work on a script, we can look at a useful function in the command line.

One of my pet peeves is overcommented configuration files, especially where documentation exists to detail the options available.

The GNU's Not Unix (GNU) Linux sed command can easily edit the file for us and remove commented lines and empty lines. We are introducing the stream editor, sed, here but we will look at it in more detail in the following chapter.

The

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required