Created
June 5, 2025 07:16
-
-
Save rbarzic/2f36ca8e604c52ef224bfd7a456f688a to your computer and use it in GitHub Desktop.
Managing cdargs files both at $HOME and in a specific directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TOP:=$(shell pwd) | |
| # cdargs management | |
| # keys starting with '-' are expected to come from a global | |
| # (under $HOME) .cdargs file | |
| cdargs_update: | |
| cat .cdargs | grep -v '^-' | sed "s|$(TOP)|\$$(TOP)|g" | sed "s|$$HOME|\$$(HOME)|g" > .cdargs_for_everyboby | |
| # Create a local .cdargs file by merging a global one (under $HOME) and .cdargs_for_everyboby | |
| cdargs_create: | |
| cat .cdargs_for_everyboby | sed "s|\$$(TOP)|$(TOP)|g" | sed "s|\$$(HOME)|$$HOME|g" > .cdargs | |
| [ -f ~/.cdargs ] && cat ~/.cdargs | sed 's/^/-/' >> .cdargs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment