When I do:
(setq pip-version (shell-command-to-string "pip3 --version"))
pip-version contains:
"pip 22.3.1 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)
"
How do I get the fourth word with the characters after the last /
removed? (/usr/local/lib/python3.9/dist-packages/)
Cecil Westerhof <Cecil@decebal.nl> writes:
When I do:
(setq pip-version (shell-command-to-string "pip3 --version"))
pip-version contains:
"pip 22.3.1 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9) >> "
How do I get the fourth word with the characters after the last /
removed? (/usr/local/lib/python3.9/dist-packages/)
(file-name-directory (nth 3 (split-string pip-version)))
See
https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Name-Components.html
https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Strings.html
https://www.gnu.org/software/emacs/manual/html_node/elisp/List-Elements.html
The Emacs Lisp documentation is great, but for non-Lispers it might be a rough ride initially.
https://www.gnu.org/software/emacs/manual/eintr.html
will get you started. Have fun learning an old, but great language!
Cecil Westerhof <Cecil@decebal.nl> writes:
When I do:
(setq pip-version (shell-command-to-string "pip3 --version"))
pip-version contains:
"pip 22.3.1 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9) >> "
How do I get the fourth word with the characters after the last /
removed? (/usr/local/lib/python3.9/dist-packages/)
(file-name-directory (nth 3 (split-string pip-version)))
See
https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Name-Components.html
https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Strings.html
https://www.gnu.org/software/emacs/manual/html_node/elisp/List-Elements.html
The Emacs Lisp documentation is great, but for non-Lispers it might be a rough ride initially.
https://www.gnu.org/software/emacs/manual/eintr.html
will get you started. Have fun learning an old, but great language!
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 00:45:47 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
10 files (20,373K bytes) |
| Messages: | 264,078 |