Mercurial Hosting > reactionary
comparison src/learn_bash.html.luan @ 76:88f46d75d28e default tip
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 07 Apr 2025 10:19:26 -0600 |
parents | b1982e401900 |
children |
comparison
equal
deleted
inserted
replaced
75:32b3994eae43 | 76:88f46d75d28e |
---|---|
1021 ~/learn $ e test.sh | 1021 ~/learn $ e test.sh |
1022 ~/learn $ | 1022 ~/learn $ |
1023 </code> | 1023 </code> |
1024 | 1024 |
1025 <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> | 1025 <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> |
1026 | |
1027 <p>Note that Bash will only look in your PATH for scripts unless you give an explicit path to the script.</p> | |
1028 | |
1029 <code block> | |
1030 ~/learn $ # edit test.sh | |
1031 ~/learn $ cat test.sh | |
1032 echo this is a shell script | |
1033 ~/learn $ test.sh | |
1034 -bash: test.sh: command not found | |
1035 ~/learn $ ./test.sh | |
1036 this is a shell script | |
1037 ~/learn $ | |
1038 </code> | |
1039 | |
1040 <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> | |
1026 <% | 1041 <% |
1027 end | 1042 end |
1028 } | 1043 } |
1029 advanced = { | 1044 advanced = { |
1030 title = [[Advanced Scripting]] | 1045 title = [[Advanced Scripting]] |