Created
September 4, 2021 14:57
-
-
Save idrisr/fc5e8edc658e8f4da71dbc5aeb919717 to your computer and use it in GitHub Desktop.
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
| # take from the book Python for DevOps, https://www.amazon.com/Python-DevOps-Ruthlessly-Effective-Automation/dp/149205769X | |
| cdp () { | |
| dir=$(python3 -c """ | |
| from pathlib import Path | |
| try: | |
| import ${1} as _ | |
| print(Path(_.__file__).parent) | |
| except Exception as e: | |
| print(e) | |
| """) | |
| cd $dir | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment