| 1 | <!doctype html> |
| 2 | |
| 3 | <title>CodeMirror: Shell mode</title> |
| 4 | <meta charset="utf-8"/> |
| 5 | <link rel=stylesheet href="../../doc/docs.css"> |
| 6 | |
| 7 | <link rel=stylesheet href=../../lib/codemirror.css> |
| 8 | <script src=../../lib/codemirror.js></script> |
| 9 | <script src="../../addon/edit/matchbrackets.js"></script> |
| 10 | <script src=shell.js></script> |
| 11 | <style type=text/css> |
| 12 | .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} |
| 13 | </style> |
| 14 | <div id=nav> |
| 15 | <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> |
| 16 | |
| 17 | <ul> |
| 18 | <li><a href="../../index.html">Home</a> |
| 19 | <li><a href="../../doc/manual.html">Manual</a> |
| 20 | <li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 21 | </ul> |
| 22 | <ul> |
| 23 | <li><a href="../index.html">Language modes</a> |
| 24 | <li><a class=active href="#">Shell</a> |
| 25 | </ul> |
| 26 | </div> |
| 27 | |
| 28 | <article> |
| 29 | <h2>Shell mode</h2> |
| 30 | |
| 31 | |
| 32 | <textarea id=code> |
| 33 | #!/bin/bash |
| 34 | |
| 35 | # clone the repository |
| 36 | git clone http://github.com/garden/tree |
| 37 | |
| 38 | # generate HTTPS credentials |
| 39 | cd tree |
| 40 | openssl genrsa -aes256 -out https.key 1024 |
| 41 | openssl req -new -nodes -key https.key -out https.csr |
| 42 | openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt |
| 43 | cp https.key{,.orig} |
| 44 | openssl rsa -in https.key.orig -out https.key |
| 45 | |
| 46 | # start the server in HTTPS mode |
| 47 | cd web |
| 48 | sudo node ../server.js 443 'yes' >> ../node.log & |
| 49 | |
| 50 | # here is how to stop the server |
| 51 | for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do |
| 52 | sudo kill -9 $pid 2> /dev/null |
| 53 | done |
| 54 | |
| 55 | exit 0</textarea> |
| 56 | |
| 57 | <script> |
| 58 | var editor = CodeMirror.fromTextArea(document.getElementById('code'), { |
| 59 | mode: 'shell', |
| 60 | lineNumbers: true, |
| 61 | matchBrackets: true |
| 62 | }); |
| 63 | </script> |
| 64 | |
| 65 | <p><strong>MIME types defined:</strong> <code>text/x-sh</code>, <code>application/x-sh</code>.</p> |
| 66 | </article> |