1
00:00:00,000 --> 00:00:05,006
(bright upbeat music)

2
00:00:05,006 --> 00:00:07,005
- [Instructor] Let's look at a couple of challenges

3
00:00:07,005 --> 00:00:11,002
related to dependencies.

4
00:00:11,002 --> 00:00:14,006
So the first question is, which module or modules loaded

5
00:00:14,006 --> 00:00:17,000
that is dynamically loaded in your system

6
00:00:17,000 --> 00:00:21,007
has the greatest number of "Used by" modules?

7
00:00:21,007 --> 00:00:24,004
Number two, which module or modules loaded

8
00:00:24,004 --> 00:00:27,002
has the greatest use count?

9
00:00:27,002 --> 00:00:30,001
And then number three, from your modules.dep file,

10
00:00:30,001 --> 00:00:35,003
which module has the greatest number of dependencies?

11
00:00:35,003 --> 00:00:39,005
Now, these can be kind of challenging to figure out

12
00:00:39,005 --> 00:00:41,003
even if you know how to do it.

13
00:00:41,003 --> 00:00:43,003
Counting stuff can be a bit tricky.

14
00:00:43,003 --> 00:00:44,007
So I'll give you a hint here.

15
00:00:44,007 --> 00:00:47,008
It takes a little bit of Shell scripting,

16
00:00:47,008 --> 00:00:51,003
so I apologize for that if you haven't done much of that.

17
00:00:51,003 --> 00:00:53,002
But I'm giving you a hint here.

18
00:00:53,002 --> 00:00:56,009
So let's say you have a line of output from the command

19
00:00:56,009 --> 00:01:01,003
that produces the list of dependencies

20
00:01:01,003 --> 00:01:06,004
or the file that produces the list of dependencies.

21
00:01:06,004 --> 00:01:10,006
What we do is we get rid of everything up to the colon.

22
00:01:10,006 --> 00:01:14,005
So this is expecting a line that has something in a colon,

23
00:01:14,005 --> 00:01:19,006
and then after that, a list separated by spaces,

24
00:01:19,006 --> 00:01:21,007
maybe bad names.

25
00:01:21,007 --> 00:01:24,006
And word count minus W will count

26
00:01:24,006 --> 00:01:28,007
those numbers of file names or paths.

27
00:01:28,007 --> 00:01:32,001
So that would give you dependent modules.

28
00:01:32,001 --> 00:01:33,008
Then let's say you have a way

29
00:01:33,008 --> 00:01:36,005
to get a list of "Used by" modules,

30
00:01:36,005 --> 00:01:40,000
and those are separated by commas.

31
00:01:40,000 --> 00:01:41,004
So this is kind of tricky here.

32
00:01:41,004 --> 00:01:42,009
We pipe that line in the set

33
00:01:42,009 --> 00:01:46,004
and we substitute anything that's not a comma.

34
00:01:46,004 --> 00:01:49,005
That's what these square brackets here say,

35
00:01:49,005 --> 00:01:52,006
not a comma for nothing.

36
00:01:52,006 --> 00:01:55,008
So that'll just leave the number of commas.

37
00:01:55,008 --> 00:01:57,003
It'll leave all the commas,

38
00:01:57,003 --> 00:01:58,009
and then you can count the number of characters

39
00:01:58,009 --> 00:02:00,003
that's counting the number of commas.

40
00:02:00,003 --> 00:02:02,004
So there's a bit of a hack.

41
00:02:02,004 --> 00:02:05,004
That'll count the number of "Used by" modules for you.

42
00:02:05,004 --> 00:02:07,003
Alright, so there's some thinking you got to do

43
00:02:07,003 --> 00:02:09,004
in a bit of work you have to do,

44
00:02:09,004 --> 00:02:11,005
but I hope you give that a try.

45
00:02:11,005 --> 00:02:12,000
Good luck.

