From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id aIBOFOnOKmTMEQEASxT56A (envelope-from ) for ; Mon, 03 Apr 2023 15:04:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4Hb5E+nOKmQahQEAauVa8A (envelope-from ) for ; Mon, 03 Apr 2023 15:04:41 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E32FD85D1 for ; Mon, 3 Apr 2023 15:04:40 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjJql-0006vj-7J; Mon, 03 Apr 2023 09:03:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjJqg-0006tt-2E for emacs-orgmode@gnu.org; Mon, 03 Apr 2023 09:03:51 -0400 Received: from ci74p00im-qukt09082101.me.com ([17.57.156.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjJqe-0005XE-BC for emacs-orgmode@gnu.org; Mon, 03 Apr 2023 09:03:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1680527024; bh=t42mZgUF7pr/ht3Es9sa2F9pLyILzrN11hbG5wKxUIY=; h=Content-Type:Mime-Version:Subject:From:Date:Message-Id:To; b=0hI1N4crSykXFIUwCfVSsACJtw3fqj4rq0lfmH0f7cSHKbEF4MNI8TnQj2TQV84w9 6o2RuYmNHhyyPQEab11Kh/r4XxkHKYiBIi3Ah0xwVVt08t0KvwCza8/OsudpY+Vb81 C5MGsIJ0vw2SDz1Vk5A4mvEXdPFKsHSTxuzqCW5pUUkvs+/j3NxNfhjzd0Q5Bv3KgB lx7ToGjP7nLhhUik1N6JIxwRJKcEoNPqDkPB34dYsAzmVVTD+o5Y8qx49m1c3pcTmx 2hqDt1JIjXqz/ReEjCzzPhPpOLYdanG+1byFlkTD16j2ZSFJCQxGZd6Lls4e7OioR9 4XvMEkmi4MyaA== Received: from smtpclient.apple (ci77p00im-dlb-asmtp-mailmevip.me.com [17.57.156.26]) by ci74p00im-qukt09082101.me.com (Postfix) with ESMTPSA id 69A1F560034C; Mon, 3 Apr 2023 13:03:42 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: Noweb Function's body without evaluation From: suarezmiguelc@icloud.com In-Reply-To: <871ql2mwdh.fsf@localhost> Date: Mon, 3 Apr 2023 15:03:29 +0200 Cc: emacs-orgmode@gnu.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <871ql2mwdh.fsf@localhost> To: Ihor Radchenko X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Proofpoint-ORIG-GUID: mUxr89C7__tB8t-QPH3iQwONLXxWM6zB X-Proofpoint-GUID: mUxr89C7__tB8t-QPH3iQwONLXxWM6zB X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.572,17.0.605.474.0000000_definitions?= =?UTF-8?Q?=3D2020-02-14=5F11:2020-02-14=5F02,2020-02-14=5F11,2020-01-23?= =?UTF-8?Q?=5F02_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxlogscore=999 clxscore=1011 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2304030097 Received-SPF: pass client-ip=17.57.156.10; envelope-from=suarezmiguelc@icloud.com; helo=ci74p00im-qukt09082101.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680527081; a=rsa-sha256; cv=none; b=gNdkJ2pUn4qVnU4oewjHY07hEwzEWSlJobNTtVZlszRSpO0v/hyDezaiNX6q1USsuGjO/m ardUNOg0pe7sTapBb2eFEJC6sceMBPiMH2t2uArJJpeckoGZ5NqaB2WNZULbYQ8Igs9Upj q3jQmnTFTGs/iJyWjOngtJ22m/mBEtIkYfrELtf8yhIuAmHVdVGRSQvobBTFbwTBX55izE kqaddv+OIb2PUdYpqUjmg+FKj2ly0W0tx/vbGfLf22SpNaQXH9LF37BGPXLEl2O0+f1GSg MNzKp45N6PmSf72KM0VZdTLvOaA/4kdPa4K6H6NUuMIPYxsutBomEJHnQ8C0ag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=icloud.com header.s=1a1hai header.b=0hI1N4cr; dmarc=pass (policy=quarantine) header.from=icloud.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680527081; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=t42mZgUF7pr/ht3Es9sa2F9pLyILzrN11hbG5wKxUIY=; b=AgRqBvhpZyh+9vE6Bht7RdcLi6Tvrp/nkgR6AhP6jpq/6PTSS0/MTrbvGXKdWGX2s+JRJo HXyUA3lskygRLTE4AFeNOSEE2hzaWIbT62WP0OtYwiH+g8u7NutLnzqRpFwBtRSc+zfsxy GC+2tZ7I1KDLt5tuc7hHEFWFghAowS5JkLVzX81DdX5ANb9eEewW73LF1WR7yLUiKxlWHW Uyo5pu+KWy88eh3yCua8xBJ5n7JIy5LvZEqgijSALVCMdeWCxm8yZM9IFmuSJyoFvm2FQ9 XIjmEsakIuatfo0evuexbZxIjEwMiZAhYvsc6VbG28GwHMbiVj9enDAeAy67eA== X-Migadu-Spam-Score: -7.16 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=icloud.com header.s=1a1hai header.b=0hI1N4cr; dmarc=pass (policy=quarantine) header.from=icloud.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Spam-Score: -7.16 X-Migadu-Queue-Id: E32FD85D1 X-TUID: 11BHpj6JPIq+ Wow, works!, thank you very much. Now, I have a more specific example. #+name: initSSH #+begin_src shell :var connection=3D=E2=80=9Cadmin@10.0.3.200" :noweb = yes ssh -t miguel@172.28.3.249 "sudo -u admin ssh -t $connection 'sudo su'" #+end_src #+name: getClientInstanceNameNew #+begin_src shell :session something :var connection=3D"admin@10.0.3.149" = :var client=3D"example_client" :var apacheDir=3D"/etc/apache/vhosts" <> client=3D$client apacheDir=3D$apacheDir grep $client $apacheDir/* #+end_src So, the initSSH call works successfully, so that concludes my first = question, being that I can now affect the $connection variable. Thank = you again! However, since the SSH call changes the environment, the $client and = $apacheDir variables are not defined in the new environment. I did try = setting it again like above, but this doesn=E2=80=99t help as the = variables do not exist. 99% of the commands I run are remote so, I will keep investigating = this. It would make more sense to use :dir and tramp, but as the = connections are slow, I can only connect with this call which works = pretty fast. > 2/4/23 12:06=E3=80=81Ihor Radchenko =E3=81=AE=E3=83= =A1=E3=83=BC=E3=83=AB: >=20 > suarezmiguelc@icloud.com writes: >=20 >> I use heavily org-mode for Literate DevOps, so I have a lot of shell = commands that connect through SSH and do some things later, for example: >>=20 >> #+name: initSSH >> #+begin_src shell :var connection=3D=E2=80=9Cadmin@somehost" >> ssh -t miguel@host "sudo -u someuser ssh -t $connection 'sudo su'" >> #+end_src >>=20 > p ...> >> #+name: getStorage >> #+begin_src shell >> df >> #+end_src >>=20 >> Which has to be run in a remote server, could be any remote server as = I have to connect to several. So I would like to be able to: >>=20 >> #+begin_src shell >> <> >> <> >> #+end_src >=20 > You can just >=20 > #+begin_src shell :var connection "admin@anotherhost" > <> > > > #+end_src >=20 > --=20 > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at