Welcome to the Linux Foundation Forum!

Unit 8 - section bash Scripts

Options

At the end of the section:

Below you can see a slightly more interactive script. Note the use of \", so the quotation marks are taken literally. This example adds reading input from a user, showing how the basic interactive session works.

_script.sh

!/bin/bash

echo "Hello World. Enter a number:"
read num
echo "Number entered was "$num""
$ ls -l script.sh
-rwxrwxr-x. 1 zelda zelda 88 Mar 8 18:11 script.sh
$ ./script.sh
Hello World. Enter a number:
42
Number entered was "42"_

Where is the use of \ ?

Categories

Upcoming Training