<br><br><div class="gmail_quote">On Fri, Jun 1, 2012 at 9:07 PM, Brian Granger <span dir="ltr"><<a href="mailto:ellisonbg@gmail.com" target="_blank">ellisonbg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On Fri, Jun 1, 2012 at 8:58 PM, MinRK <<a href="mailto:benjaminrk@gmail.com">benjaminrk@gmail.com</a>> wrote:<br>
> I was playing with my shebang magic, and I decided to test something evil:<br>
><br>
>     @cell_magic('#!')<br>
>     def shebang(self, line, cell):<br>
>         """Run a cell via a shell command<br>
<br>
</div>Oh, what fun, I love it!  Actually, this is not that crazy considering<br>
that we already have the `!foo` syntax.  I guess the important<br>
question is this: are the any constraints on the names of cell magics<br>
at all?  Will this mess up things somehow?<br>
<div class="im"><br>
>         The `%%shebang` line is like the #! line, specifying a program<br>
> (bash, perl, ruby, etc.)<br>
>         """<br>
>         p = Popen(line, stdout=PIPE, stderr=PIPE, stdin=PIPE)<br>
>         out,err = p.communicate(cell)<br>
>         print(out, end='')<br>
>         print(err, file=sys.stderr, end='')<br>
><br>
><br>
> Which actually lets me do:<br>
><br>
> %%#! bash<br>
> for i in 1 2 3; do<br>
>   echo $i<br>
> done<br>
><br>
> I presume we don't want that to actually work, right?  Kinda fun, though.<br>
<br>
</div>I think there are two questions:<br>
<br>
* Will this actually break something?<br></blockquote><div><br></div><div>I imagine we want magics to be identifiers, but I guess `%%...<space>` is sufficiently well defined that there's no technical reason why any unicode characters should be illegal.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* Is another name for this magic clearer?<br></blockquote><div><br></div><div>I was just going to call it `%%shebang`, I think `%%#!` is a few too many special characters in a row.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br>
Cheers,<br>
<br>
Brian<br>
<br>
> -MinRK<br>
><br>
> _______________________________________________<br>
> IPython-dev mailing list<br>
> <a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Brian E. Granger<br>
Cal Poly State University, San Luis Obispo<br>
<a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</font></span></blockquote></div><br>