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