emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Xi Shen <davidshen84@gmail.com>
To: Michael Welle <mwe012008@gmx.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: Is it possible to pass variable to variables of src block?
Date: Tue, 12 Dec 2017 06:30:01 +0000	[thread overview]
Message-ID: <CANO68EMA5Abr1wBsoZ386i+b36QzXyT4d8Ssfxszr88jkGiNKg@mail.gmail.com> (raw)
In-Reply-To: <877eu0gq3p.fsf@luisa.c0t0d0s0.de>

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

Hi Michael,

Yes, I think this is a way to my previous question. But what I really want
to achieve is to loop through a list of server names and execute a script
on them.

Say I have 20 different database server. How can I do a loop with each
server?


Regards,
David


On Wed, Dec 6, 2017 at 5:34 PM Michael Welle <mwe012008@gmx.net> wrote:

> Hello,
>
> Xi Shen <davidshen84@gmail.com> writes:
>
> > Hi,
> >
> > http://orgmode.org/manual/var.html
> >
> > This wiki explains how to use variable inside a src block. But I wonder
> if
> > it is possible to specify variable to the variables in the src
> definition.
> >
> > E.g. for the sql src block, I want to execute a script on different
> server.
> > I want to define a variable for the ":dbhost" variable.
> did you think about something like this?
>
>
> (setq hmw/dbhost "db1")
>
> #+BEGIN_SRC sql :dbhost (symbol-value 'hmw/dbhost) :dbuser weather
> :database environment :engine postgresql
> select time, temperature from weather limit 20;
> #+END_SRC
>
> Regards
> hmw
>
>

[-- Attachment #2: Type: text/html, Size: 1651 bytes --]

  reply	other threads:[~2017-12-12  6:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05  5:19 Is it possible to pass variable to variables of src block? Xi Shen
2017-12-06  9:31 ` Michael Welle
2017-12-12  6:30   ` Xi Shen [this message]
2017-12-12  7:17     ` Ihor Radchenko
2017-12-13  9:57     ` Michael Welle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANO68EMA5Abr1wBsoZ386i+b36QzXyT4d8Ssfxszr88jkGiNKg@mail.gmail.com \
    --to=davidshen84@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mwe012008@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).