basics.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html>
  2. <html lang="en-US">
  3. <head>
  4. <title>SlideScript API: The Basics ~ The Lazy Language</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1" />
  7. <meta name="description" content="SlideScript API and Documentation section - SlideScript is a micro stripting language with the intent to give the world an effective shell like experience with the ability to use a sloppy syntax! SlideScript can do simple every day shell tasks like manipulating and working with files, and directories, piping, variable support, and backquoting, with a bit of spice like: built-in md5, and encoder / decoder, webserver, networking functions, tar and compression functions, PLUS MORE!" />
  8. <link href="../style.css" rel="stylesheet" type="text/css" />
  9. </head>
  10. <body>
  11. <table><tr><td>
  12. <div class="header">
  13. <img src="../sslogo.png" class="logoimg" title="SlideScript logo" alt="SlideScript" />
  14. </div>
  15. </td></tr><tr><td>
  16. <div class="menu"><!--
  17. --><a href="../index.html">Home</a><!--
  18. --><a href="index.html">Documentation</a><!--
  19. --><a href="https://notabug.org/Pentium44/slidescript">Git</a><!--
  20. --></div>
  21. </td></tr></table>
  22. <div class="container">
  23. <h2>Getting SlideScript</h2>
  24. <p>
  25. Starting off with SlideScript, you'll first need to obtain the source and build it.
  26. We're going to assume you're using a *nix based system today, so the easiest way to
  27. get the source is with a tool a developer should be familiar with: git.<br /><br />
  28. <b>Installing system-wide:</b>
  29. <pre><code>
  30. # git clone https://notabug.org/Pentium44/slidescript
  31. # cd slidescript/
  32. # make & make install
  33. # slidescript
  34. ss:prompt:
  35. </code></pre>
  36. <b>Running after build:</b>
  37. <pre><code>
  38. # git clone https://notabug.org/Pentium44/slidescript
  39. # cd slidescript/
  40. # make
  41. # ./slidescript
  42. ss:prompt:
  43. </code></pre>
  44. From this step, you should easily have built SlideScript, and
  45. would be sitting at the fancy incorporation of an interactive shell.
  46. Want to use it at as a script? Just make a file "script.ss", and
  47. add a shebang after system wide install:<br />
  48. <code>#!/usr/bin/slidescript</code>
  49. <br /> Of course, make sure your script is executable!
  50. </p>
  51. <h2>Variables &amp; strings</h2>
  52. <p>
  53. SlideScript will parse an equal character into a variable using the
  54. contents on each side of such equal character. No quotes are needed
  55. after an equal character and can be ended via new-line. You can print
  56. variables and/or strings to stdout in SlideScript using the "print" function.
  57. Examples (interactive and scripted):
  58. <pre><code>
  59. ss:prompt: buffer=This will be the contents of variable "buffer"
  60. ss: var 'buffer' -> This is the contents of variable "buffer"
  61. ss:prompt: print "%buffer%"
  62. This is the contents of variable "buffer"
  63. ss:prompt:
  64. OR
  65. #!/usr/bin/slidescript
  66. # This is a comment, script away
  67. buffer=This will be the contents of variable "buffer"
  68. print "%buffer%"
  69. # Unset function on variables similar to perl
  70. unset "buffer" # Dumps buffer from memory!
  71. </code></pre>
  72. From here, we are going to be refering to all examples as scripts. Yes,
  73. SlideScript does have interactive mode for being a convenient all-in-one
  74. shell, but lets focus on the scripting side of things; shall we?
  75. </p>
  76. <h2>Piping, math &amp; backquoting</h2>
  77. <p>
  78. Piping is very similar to piping within a *nix shell. In SlideScript,
  79. the piping character remains "vertical bar" or "|". The return value
  80. of the function processed on the left side of the piping character will
  81. be pushed into a variable known as "PIPE". Hmm, wonder why? :P
  82. You can use piping in recursion in SlideScript. <br />
  83. Backquotes or "`" are used within SlideScript, mainly in variables,
  84. for processing functions within the language, and saving the returned value
  85. as a string. For example: whatsthetime=`time` would be saved as:
  86. ss: var 'whatsthetime' -> Wed Jun 9 17:56:23 2021<br />
  87. Here are some examples:
  88. <pre><code>
  89. #!/usr/bin/slidescript
  90. # First, lets show how a pipe works:
  91. print "hello" | print "%PIPE% world" # Returns: hello world
  92. # Now for stacked piping, lets use a variable with the current time, and
  93. # Play with it!
  94. whatsthetime=`time` # return: ss: var 'whatsthetime' -> Wed Jun 9 17:56:23 2021
  95. calc "56.5 * 6.25" | print "Solved: %PIPE%" | print "[%whatsthetime%] %PIPE%"
  96. ### Return value of the contraption: [Wed Jun 9 17:56:23 2021] Solved: 353.125000
  97. # This is more for, how math works in SlideScript #
  98. # Example of using piping to do mathimatical equations with parathesis!
  99. calc "33.3 / 2" | calc "%PIPE% * 26" | calc "%PIPE% + 2" # Return: 434.899994
  100. </code></pre>
  101. </p>
  102. <h3>IRC server</h3>
  103. <p>
  104. Still need help? Want to report a bug? Join us!<br /><br />
  105. IP/Port: cddo.cc/1337<br />
  106. Main hang channel: <b>#theroot</b><br />
  107. FreeBox channel: <b>#freebox</b><br />
  108. FreonLinux channel: <b>#freonlinux</b>
  109. </p>
  110. </div>
  111. <div class="footer">
  112. &copy; Chris Dorman, 2021 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode">CC BY-NC-SA 4.0</a> - Software GPLv2 licensed<br />
  113. <p>
  114. Powered by:<br />
  115. <a href="https://freedns.afraid.org/">
  116. <img style="width:100px;" src="https://freedns.afraid.org/images/freedns_crop.png" />
  117. </a>
  118. <a href="https://letsencrypt.org/">
  119. <img style="width: 100px;" src="https://letsencrypt.org/images/le-logo-wide.png" />
  120. </a>
  121. <a href="http://jigsaw.w3.org/css-validator/check/referer">
  122. <img style="border:0;width:80px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" />
  123. </a>
  124. </p>
  125. </div>
  126. </body>
  127. </html>