From 22857a159a282e9f8193363178d524921e6cd1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lindi?= <bjorn.lindi@ntnu.no> Date: Wed, 5 Oct 2022 07:04:12 +0000 Subject: [PATCH] Update content/episodes/14-modules.md --- content/episodes/14-modules.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/content/episodes/14-modules.md b/content/episodes/14-modules.md index 2fca0c3..b878e50 100644 --- a/content/episodes/14-modules.md +++ b/content/episodes/14-modules.md @@ -102,7 +102,7 @@ is looping through when looking for the `python` command. In this case it finds a match under `/usr/bin`, so then it exits the search and replaces `python` with `/usr/bin/python`. -```{discussion} +`````{exercise} Exercise (10 min) 1. What happens if there are other matching commands located later in the search `PATH`, e.g. `/cluster/bin/python`? @@ -110,7 +110,19 @@ a match under `/usr/bin`, so then it exits the search and replaces `python` with 2. What happens if you have an executable script in your current directory with the same name as a globally installed program? +````{solution} +1. If there are other matching commands later in the search path, these will be +shadowed by first found command. The shell will stop searching for more commands +when it has found the command in a directory. + +2. If your current directory is first in the search path it will executed. On the +other hand if the directory with the global installed program is first in the search +path, it will be executed. To execute a command named python in your current directory, do: +```console +$ ./python ``` +```` +````` ## Environment modules -- GitLab