1
00:00:00,960 --> 00:00:06,540
Second option how to assign a variable is by using a raid command.

2
00:00:06,810 --> 00:00:16,500
We are using grid command space and then the name of our variable using grid command is an interactive

3
00:00:16,500 --> 00:00:18,960
way how to set a variable.

4
00:00:18,960 --> 00:00:25,320
Classic example of read the command can be read in the age from user's input.

5
00:00:25,320 --> 00:00:31,780
Then we can display Redbirds by prepending assign let's write some script to practice this option.

6
00:00:34,030 --> 00:00:37,560
I will create a file called read s h

7
00:00:40,990 --> 00:00:42,210
on the first line.

8
00:00:42,220 --> 00:00:44,620
Don't forget to start with shebeen.

9
00:00:47,070 --> 00:00:48,570
Bin bash

10
00:00:51,510 --> 00:00:57,140
on the next line will ask users to put their names here.

11
00:00:57,220 --> 00:01:05,800
And it means that echo command won't add new line so we can continue on the same line now by typing

12
00:01:05,840 --> 00:01:06,780
good he'd name.

13
00:01:06,780 --> 00:01:12,240
We are storing user input to a variable called name.

14
00:01:12,330 --> 00:01:16,530
Also read age in the same way.

15
00:01:16,530 --> 00:01:19,370
Read age.

16
00:01:19,740 --> 00:01:25,550
Now we can print our variables to see the results.

17
00:01:26,560 --> 00:01:29,190
école employs statistic

18
00:01:35,180 --> 00:01:38,860
and let's bring some information about name

19
00:01:43,360 --> 00:01:45,750
Eco Age.

20
00:01:46,170 --> 00:01:48,210
Do not assign

21
00:01:50,910 --> 00:01:51,300
age

22
00:01:54,590 --> 00:01:56,590
fit and save your Edita Or

23
00:02:01,630 --> 00:02:07,740
And we also need to change permission in order to Rander script.

24
00:02:08,020 --> 00:02:11,040
So change mode a plus x.

25
00:02:11,090 --> 00:02:11,820
Read S H

26
00:02:14,690 --> 00:02:20,880
and now we can see that we have run permissions so we can run the script

27
00:02:23,470 --> 00:02:25,130
so we are named John.

28
00:02:25,150 --> 00:02:26,720
Age 50.

29
00:02:27,130 --> 00:02:30,600
Yeah and voila we see the results works perfectly.

30
00:02:34,070 --> 00:02:40,960
I will clear the screen and create new script called read to.

31
00:02:41,080 --> 00:02:47,010
As I age first line is dedicated to siobhán

32
00:02:50,750 --> 00:02:59,300
bit mesh on the next line we'll use it month with parameter b.

33
00:02:59,330 --> 00:03:03,730
This allows us to print some message and read the user's input.

34
00:03:03,740 --> 00:03:12,230
Basically it is equal and that it commands first part its message then a space and then the second part

35
00:03:12,650 --> 00:03:18,890
variable name where we want to store user input on the next line.

36
00:03:18,890 --> 00:03:28,100
I also add another parameters as this means that user cannot see on the screen what is typing this behavior

37
00:03:28,130 --> 00:03:31,500
is usually used when we want to read someone password.

38
00:03:31,820 --> 00:03:37,760
But in our case we just want to hide user age from being displayed on the screen when the script reads

39
00:03:37,760 --> 00:03:40,740
it will print.

40
00:03:40,770 --> 00:03:43,490
Do variables values in equal command.

41
00:03:46,070 --> 00:03:47,370
Age or age

42
00:03:52,590 --> 00:04:02,920
and now save the file and it and we need to go around with permissions to script.

43
00:04:02,920 --> 00:04:03,880
Now we can that it

44
00:04:10,370 --> 00:04:12,190
name is John.

45
00:04:12,380 --> 00:04:13,570
Age is 50.

46
00:04:13,790 --> 00:04:14,690
I'm typing it.

47
00:04:14,690 --> 00:04:18,320
But on the screen you cannot see it.

48
00:04:18,530 --> 00:04:23,770
It works great but our output is displayed on the same time as age city.

49
00:04:23,810 --> 00:04:26,420
So I am going to correct it.

50
00:04:31,070 --> 00:04:36,990
And I will just add new took command before printing the variables values.

51
00:04:40,230 --> 00:04:43,580
So save the file and running again.

52
00:04:44,190 --> 00:04:49,910
Name John H 50.

53
00:04:50,760 --> 00:04:52,620
Yeah and it works perfectly.

54
00:04:54,820 --> 00:05:01,390
Using grid command we can also read from files that say we want to start into a variable the content

55
00:05:01,420 --> 00:05:06,410
of UTC hostname file which is in my case you want to 16.

56
00:05:06,640 --> 00:05:12,730
I will create a file read from file as age

57
00:05:16,160 --> 00:05:19,130
and as you will I will start with siobhán

58
00:05:22,820 --> 00:05:23,870
bin bash

59
00:05:26,590 --> 00:05:29,020
on the next line right.

60
00:05:29,160 --> 00:05:37,200
I read hostname then let's of Dentyne which means that the variable from big file and then the file

61
00:05:37,200 --> 00:05:37,630
name

62
00:05:40,350 --> 00:05:43,820
on the next line will print the variable value.

63
00:05:51,930 --> 00:06:00,280
Echo hostname Dallara hostname.

64
00:06:00,380 --> 00:06:04,550
Now safe and create your editor.

65
00:06:06,040 --> 00:06:07,100
Change permissions

66
00:06:11,110 --> 00:06:13,770
and verandahs script to see the hostname file

67
00:06:19,740 --> 00:06:20,860
great Valks.

68
00:06:20,880 --> 00:06:21,230
Well.
