3

How do you execute multiple actions on a single org-link?

Org-mode has links that can initiate actions, such as elisp: and shell:. It would be nice to initiate several such actions on following a single link.

Just creating a shell-file containing the tasks is possible, but seems inelegant.

How is this best done?

3

You can separate shell commands with a ;, like so:

[[shell:whoami%3B%20id][Two commands]]

The link you type in would be shell:whoami; id (it's stored in the document with special characters encoded).

Similarly, for Emacs Lisp, the link you type in might be:

elisp:(progn (message "Hello") (message "World!"))
  • For shell scripts, cmd1 && cmd2 might be better as it only executes the second command if the first succeeded. – erikstokes Aug 19 '15 at 23:35
  • Works for several shell commands or several elisp commands. How would you execute two shell commands and then open a file? – serv-inc Aug 20 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.