diff --git a/README.md b/README.md index 159f9c0..ff820b3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1453 TILs and counting..._ +_1454 TILs and counting..._ --- @@ -80,6 +80,7 @@ _1453 TILs and counting..._ * [XState](#xstate) * [YAML](#yaml) * [Zod](#zod) +* [Zsh](#zsh) --- @@ -1726,6 +1727,10 @@ _1453 TILs and counting..._ - [Incorporate Existing Type Into Zod Schema](zod/incorporate-existing-type-into-zod-schema.md) - [Set Custom Error Message For Nonempty Array](zod/set-custom-error-message-for-nonempty-array.md) +### Zsh + +- [Add To The Path Via Path Array](zsh/add-to-the-path-via-path-array.md) + ## Usage The `.vimrc` file for this project contains a function `CountTILs` that can diff --git a/zsh/add-to-the-path-via-path-array.md b/zsh/add-to-the-path-via-path-array.md new file mode 100644 index 0000000..dc8412c --- /dev/null +++ b/zsh/add-to-the-path-via-path-array.md @@ -0,0 +1,25 @@ +# Add To Path Via Path Array + +Typically when managing what is on your path in a Unix shell environment, you +override the `PATH` environment variable with `export`. This is usually an +append or prepend to bring along the existing path entries. + +```bash +$ export PATH="$PATH:/Users/me/.local/bin" +``` + +The `zsh` shell environment exposes another way of adding to your path. They +have a `path` array which can be a little easier to work with since you can use +an array operation instead of string interpolation. + +Here is how we'd do the same as above: + +```bash +$ path+=/Users/me/.local/bin +``` + +This works because there is an automatic linking in zsh between arrays and +colon-separated strings (_scalars_). +[source](https://www.zsh.org/mla/users//2005/msg01132.html) + +[source](https://superuser.com/a/1447959)