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 over commented configuration files, especially where documentation exists to detail the options available.

The GNU Linux command sed 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 sed command line that runs ...

Get Mastering Linux Shell Scripting now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.