Timeline for answer to Unix shell function for adding directories to PATH by vnp
Current License: CC BY-SA 3.0
Post Revisions
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 10, 2022 at 14:56 | comment | added | raratiru | Here is a nice way to restore IFS | |
| Nov 8, 2018 at 14:04 | comment | added | Toby Speight |
You probably don't want to just return there without also restoring IFS.
|
|
| Apr 29, 2015 at 19:08 | comment | added | janos |
I like this. But I'd go with the shorter $pathdir == $1 && return
|
|
| Apr 28, 2015 at 18:53 | comment | added | vnp |
@Sildoreth No. Looping via builtins is fast (at least comparing to a fork/exec of grep invocation).
|
|
| Apr 28, 2015 at 18:32 | comment | added | Sildoreth |
Won't this be slower, though? In this solution, we're using a script to perform looping whereas the original solution has grep, which runs at the machine level, doing the looping for us.
|
|
| Apr 28, 2015 at 17:16 | history | answered | vnp | CC BY-SA 3.0 |