[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
not-instantly-obvious method to get output of shell command to variable
From: |
Emanuel Berg |
Subject: |
not-instantly-obvious method to get output of shell command to variable |
Date: |
Thu, 31 Jul 2014 00:39:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Just wrote this to load the configuration files from
.emacs.
Did spend some (pleasant) time getting the output of
the shell (zsh) command "ls" into the variable `files'
(check it out).
Perhaps that is yet another thing to add for everyone
to use from the holster?
I agree silly configuration and cool hacks shouldn't be
added (unless they are really cool) but such basic
building blocks are great. It boosts creativity if
people don't have to get stuck on details all the time
when they want to do creative stuff.
(let ((files (with-temp-buffer
(call-process-shell-command
"ls ~/.emacs.d/emacs-init/**/*.elc ~/.emacs-no-bc"
nil ; no INFILE
t) ; BUFFER (t = current buffer, i.e. the temp one)
(buffer-substring (point-min) (point-max)) )))
(dolist (f (split-string files)) (load-file f)) )
--
underground experts united
- not-instantly-obvious method to get output of shell command to variable,
Emanuel Berg <=