emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to escape # character in #+begin_src bash block for html exp


From: Michael Welle
Subject: Re: [O] How to escape # character in #+begin_src bash block for html export?
Date: Sun, 25 Mar 2018 10:39:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3.50 (gnu/linux)

Hello,

Abigaile Johannesburg <address@hidden> 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
> $<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?
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]