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