[
151
]
Save the file and exit the editor. In order to run this file as a script, we need to mark it
as executable:
chmod +x ~/myscript.sh
To execute it, we simply call the path to the file and the filename:
~/myscript.sh
The output should look similar to the following:
My name is jay
My home directory is /home/jay
My default text editor is vim
The first line,
#!/bin/bash
, might seem strange if you haven't seen it before.
Normally, lines starting with a hash symbol (
#
) are ignored by the interpreter. The
one on the first line is an exception to this. The
#!/bin/bash
entry we see on the first
line is known as a
Do'stlaringiz bilan baham: |