MoreBash:Exercises - Functions - Introduction

From Juneday education
Jump to: navigation, search

Work in progress

This chapter is a work in progress. Remove this section when the page is production-ready.

TODO: Write exercises

Prerequisite knowledge

These exercises assume that you have basic knowledge of Bash, computers and networks. We have books covering some of these basics, if you need to refresh them.

Introduction

The purpose of these exercises is to get you familiar with functions in bash. See the previous chapter PDF (and if available lecture video) for an introduction to bash functions. Be sure to read also the external links for further reading of the previous chapter.

Trouble-shooting

If you get this error from running a script:

syntax error near unexpected token `$'{\r''

...then you probably have modified the script in a Windows editor so that it got CRLF line endings (the Windows style line endings).

You can convert the file (any text file, actually) from windows format to Unix format using dos2unix (install it in Cygwin if you are running Cygwin). If you are using a text editor, you can always change the line endings in the file:

Atom: Look for the letters CRLF at the bottom of the editor, click on it and change it to LF only.

Notepad++: Edit -> EOL Conversion -> Unix Format

Exercises

Task 1 -

Next task...

Expand using link to the right to see a hint.

Task 2 -

Next task...

Expand using link to the right to see a hint.

Task 3 -

Next task...

Expand using link to the right to see a hint.

Task 4 -

Next task...

Expand using link to the right to see a hint.

Links

Chapter links

Next page introduces a new topic: Tools

« PreviousBook TOCNext »