[Intro Music]
I hope you were able to easily
correct this challenge. Let's now
do that together. Let's first
export new variable, 'export MY_NAME',
and the value will
be in my case 'Bogdan'. Now, let's
create a new file called name.sh.
'touch name.sh'. And now let's edit
it using Nano Editor, 'nano name.sh'.
Here on the first line will be '#'
sign, next comes '!',
and afterwards will be path to
corresponding executable that will
launch this executable file '/bin/bash',
and on next line, I'll simply use
'echo $MY_NAME', like this.
Very simple. Let's save this file.
And now let's list files and
folders here in home directory, 'ls
-la'; and I see this newly
created file, name.sh. But now this
file is not executable. You see
here those permissions. I am able
to read, write this file as owner,
and other users in the same group
'bogdan' are also able to read and
write file. All the remaining users
in other groups are able only to
read this file. Now let's add
execution permission for this file.
And I could do that using 'chmod'
command. And here I could use
simply syntax '+x', add execution
permission. And next will come
name of the file, name.sh. Let's
press Enter. Let's verify now
permissions. And now you see that
everyone is able to execute this
file. If you don't want that anyone
else will be able to execute it, you
could of course remove 'x', for all
remaining users and leave 'x' only
for this user. For that you could
use either 'u+x' syntax, first
remove 'x'. Let me show you it
actually quickly. Let's go back and
remove execution permission like
this. And next let's add '+x'
only for user, 'u+x', like so. And now
let's verify permissions. And
you'll see that now only the owner
of this file is able to execute it.
Now let's run it. I could use either
absolute path to this file,
name.sh or relative path. Let's use,
let's say relative path, './',
and name of the file, 'name.sh'; and I
see my name here in the terminal.
That means that this script works
correctly, and this script is able
to get access to environment
variables. Let's quickly have a
look at the contents of this
script. And here's this line that
accesses MY_NAME variable that we
have created before with 'export'
command. Alright, that's all for
solution for this challenge. And
that's all actually for this section.
[no audio]