From mboxrd@z Thu Jan 1 00:00:00 1970 From: Abigaile Johannesburg Subject: How to escape # character in #+begin_src bash block for html export? Date: Thu, 22 Mar 2018 17:18:18 +0100 (CET) Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_170719_503919411.1521735498326" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ez2v2-0007bi-Fo for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 12:18:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ez2uz-0002RZ-BX for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 12:18:24 -0400 Received: from w1.tutanota.de ([81.3.6.162]:43348) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ez2uz-0002Mj-0X for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 12:18:21 -0400 Received: from w1.tutanota.de (unknown [192.168.1.162]) by w1.tutanota.de (Postfix) with ESMTP id 540ECFB6503 for ; Thu, 22 Mar 2018 16:18:18 +0000 (UTC) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org ------=_Part_170719_503919411.1521735498326 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Dear community, I have a minor question about how to escape '#' character in #+begin_src bash block. For example, when I export the source code block for bash, I can use #+begin_src bash $ #+end_src But if I want to use # for indicating commands for root or privileged user, if I use #+begin_src bash # #+end_src then the commands after '#' will be in italics, i.e., they are treated as comments in html export. How do I solve this problem? Thanks in advance. Abi ------=_Part_170719_503919411.1521735498326 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Dear community,

I have a minor question about how to escape '#' character in #+begin_src bash block. For example, when I export the source code block for bash, I can use

#+begin_src bash
$<some bash command for normal user>
#+end_src

But if I want to use # for indicating commands for root or privileged user, if I use

#+begin_src bash
#<some bash command for root user>
#+end_src

then the commands after '#' will be in italics, i.e., they are treated as comments in html export.

How do I solve this problem?

Thanks in advance.

Abi
------=_Part_170719_503919411.1521735498326-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Welle Subject: Re: How to escape # character in #+begin_src bash block for html export? Date: Sun, 25 Mar 2018 10:39:10 +0200 Message-ID: <87tvt4o8gh.fsf@luisa.c0t0d0s0.de> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f01BP-0002cU-V9 for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 04:39:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f01BM-0006Q6-Ra for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 04:39:19 -0400 Received: from mout.gmx.net ([212.227.17.21]:54527) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f01BM-0006Og-HI for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 04:39:16 -0400 Received: from stella.c0t0d0s0.de ([89.204.153.191]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M8pKi-1esITV0xHY-00CA9A for ; Sun, 25 Mar 2018 10:39:13 +0200 Received: from Stella (stella.c0t0d0s0.de [192.168.42.1]) by stella.c0t0d0s0.de (Postfix) with ESMTP id B9071C4080 for ; Sun, 25 Mar 2018 10:39:10 +0200 (CEST) In-Reply-To: (Abigaile Johannesburg's message of "Thu, 22 Mar 2018 17:18:18 +0100 (CET)") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hello, Abigaile Johannesburg writes: > Dear community, > > I have a minor question about how to escape '#' character in > #+begin_src bash block. For example, when I export the source code > block for bash, I can use > > #+begin_src bash > $ > #+end_src > > > But if I want to use # for indicating commands for root or privileged > user, if I use > > #+begin_src bash > # > #+end_src > > then the commands after '#' will be in italics, i.e., they are treated > as comments in html export. > > How do I solve this problem? I'm not sure if I understand your problem correctly. # starts a comment in shell, and $ denotes (among others maybe) a variable name. In that sense #+begin_src bash $ls #+end_src delivers the value of the variable ls. The semantic of $ is not to execute the command ls as a non-root user. Same goes for #. If you want to put your own semantics into $ and # it might be better to not use a bash code block. If you want to note that some commands in a script needs root privilege, maybe something like this would do the trick: #+begin_src bash ls su - -c 'fdisk /dev/rdsk/c0d1/p0' emacs& #+end_src Regards hmw From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: How to escape # character in #+begin_src bash block for html export? Date: Sun, 25 Mar 2018 18:10:18 -0400 Message-ID: <87o9jbbyd1.fsf@alphaville.usersys.redhat.com> References: <87tvt4o8gh.fsf@luisa.c0t0d0s0.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0DqS-0008Bq-GM for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 18:10:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0DqP-0006ZH-2P for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 18:10:32 -0400 Received: from [195.159.176.226] (port=44962 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0DqO-0006YR-Ko for emacs-orgmode@gnu.org; Sun, 25 Mar 2018 18:10:28 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1f0DoH-0000fl-Bd for emacs-orgmode@gnu.org; Mon, 26 Mar 2018 00:08:17 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Michael Welle writes: > Hello, > > Abigaile Johannesburg writes: > >> Dear community, >> >> I have a minor question about how to escape '#' character in >> #+begin_src bash block. For example, when I export the source code >> block for bash, I can use >> >> #+begin_src bash >> $ >> #+end_src >> >> >> But if I want to use # for indicating commands for root or privileged >> user, if I use >> >> #+begin_src bash >> # >> #+end_src >> >> then the commands after '#' will be in italics, i.e., they are treated >> as comments in html export. >> >> How do I solve this problem? > I'm not sure if I understand your problem correctly. # starts a comment > in shell, and $ denotes (among others maybe) a variable name. In that > sense > > #+begin_src bash > $ls > #+end_src > > > delivers the value of the variable ls. The semantic of $ is not to > execute the command ls as a non-root user. Same goes for #. If you want > to put your own semantics into $ and # it might be better to not use a > bash code block. > > If you want to note that some commands in a script needs root privilege, > maybe something like this would do the trick: > > #+begin_src bash > ls > su - -c 'fdisk /dev/rdsk/c0d1/p0' > emacs& > #+end_src > > Regards > hmw > > As Michael Welle points out #+begin_src shell # date #+end_src is a do-nothing source block since the command is commented out. If you are trying to produce documentation and want to show commands that the user should type then you probably need an example block: #+begin_example # date #+end_example -- Nick From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Welle Subject: Re: How to escape # character in #+begin_src bash block for html export? Date: Mon, 26 Mar 2018 11:32:59 +0200 Message-ID: <877epzgp10.fsf@luisa.c0t0d0s0.de> References: <87tvt4o8gh.fsf@luisa.c0t0d0s0.de> <87o9jbbyd1.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0OVC-0002xG-Q9 for emacs-orgmode@gnu.org; Mon, 26 Mar 2018 05:33:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0OUx-0005th-7h for emacs-orgmode@gnu.org; Mon, 26 Mar 2018 05:33:18 -0400 Received: from mout.gmx.net ([212.227.15.15]:45243) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0OUw-0005s7-QI for emacs-orgmode@gnu.org; Mon, 26 Mar 2018 05:33:03 -0400 Received: from stella.c0t0d0s0.de ([194.95.66.1]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M9s2y-1epLsq15XU-00B1fp for ; Mon, 26 Mar 2018 11:33:00 +0200 Received: from Stella (stella.c0t0d0s0.de [192.168.42.1]) by stella.c0t0d0s0.de (Postfix) with ESMTP id 3BBADC4080 for ; Mon, 26 Mar 2018 11:32:59 +0200 (CEST) In-Reply-To: <87o9jbbyd1.fsf@alphaville.usersys.redhat.com> (Nick Dokos's message of "Sun, 25 Mar 2018 18:10:18 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hello, Nick Dokos writes: [...] > Michael Welle writes: > If you are trying to produce documentation and want to show commands > that the user should type then you probably need an example block: > > #+begin_example > # date > #+end_example another idea: How about using shell code blocks for root commands as well and attaching a CSS class to the block and colour the background? Regards hmw