Mercurial Hosting > reactionary
changeset 76:88f46d75d28e default tip
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 07 Apr 2025 10:19:26 -0600 |
parents | 32b3994eae43 |
children | |
files | src/learn_bash.html.luan |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/learn_bash.html.luan Sun Apr 06 09:07:55 2025 -0600 +++ b/src/learn_bash.html.luan Mon Apr 07 10:19:26 2025 -0600 @@ -1023,6 +1023,21 @@ </code> <p>When you write useful scripts, put them in a directory and add that directory to your PATH. I use <code>~/Dropbox/bin</code> and I have a script named <code>e</code> in that directory for editing files. So <code>e test.sh</code> lets me edit <code>test.sh</code> from the command line.</p> + +<p>Note that Bash will only look in your PATH for scripts unless you give an explicit path to the script.</p> + +<code block> +~/learn $ # edit test.sh +~/learn $ cat test.sh +echo this is a shell script +~/learn $ test.sh +-bash: test.sh: command not found +~/learn $ ./test.sh +this is a shell script +~/learn $ +</code> + +<p>Calling <code>test.sh</code> by itself fails because it isn't in the PATH. But <code>./test.sh</code> works because it is an explicit path.</p> <% end }