#!/usr/bin/slidescript ############################################################# #### Welcome to the world of SlideScript! #### #### This script is here for the learning purposes of SS #### #### Any line starting with a hashtag will treated as a #### #### comment! #### ############################################################# # Slide Script, also refered to as SS, is extremely forgiving in # syntax handling! # Example: # print "content" # print "content"; # print("content") # print("content"); ### ### These will operate properly, as well as: # Example: # write "filename.txt" "data" # write "filename.txt" "data"; # write("filename.txt" "data"); # write("filename.txt", "data"); # # IT ALL WORKS! # SlideScript really syntaxes based on quotes and key function words, # as well as pipes. It really doesn't mind whats around it otherwise # And every variable is called by %varname%, defining variables, as normal # Variables in SS ss_filename=file.txt ss_stringdata=Data to encrypt and decrypt ss_exec_command=uname -a # Printing function in SS print "Welcome to SlideScript!" # Sleep function in SS print "Some content to print, working with '%ss_filename%' today!" # Below demonstrates SS encrypting a string, passing the output # over a pipe, and using the write function and %PIPE% variable # holding the first functions output, writes to %ss_filename%; file.txt ### %PIPE% is the output from the first line function, enc ### %PIPE% is always applied when a pipe is used! encode "%ss_stringdata%" | write "%ss_filename%" "%PIPE%" # You're left with file.txt, lets move on # Lets read the file we just created and show how SS handles its # own decryption algorithm read "%ss_filename%" | decrypt "%PIPE%" # Will display the original variable string! # SS MD5 function # Lets get the md5sum of file.txt with our md5 function md5 "%ss_filename%" | write "%ss_filename%.md5" "%PIPE%" # Use a pipe, and push the md5 into a text file of file.txt # You can also stack pipes for whatever tasks you may need # Here's the encrypt function in action, can also be used as encode md5 "%ss_filename%" | encode "%PIPE%" | write "%ss_filename%.md5.enc" "%PIPE%" # Read md5 file print "%ss_filename%.md5:" read "%ss_filename%.md5" # Read encrypted md5 file and decrypt using decode alias print "%ss_filename%.md5.enc:" read "%ss_filename%.md5.enc" | decode "%PIPE%" # Delete function, SS can delete files and directories with one function # NOTE: it is extremely powerful and can wreck your system if used in the # wrong way! Proceed with caution, delete "/" WILL send your files to the # grave. ### # Lets delete the files we've been messing with, no system calls needed delete "%ss_filename%" delete "%ss_filename%.md5" delete "%ss_filename%.md5.enc" # Gone! print "Playing with some calc..." # calc function, lets do some basic math calc "32 * 1024" # You can pipe calc to do multi layer equations calc "32 * 1024" | calc "%PIPE% * 2" # Lets play with some big numbers here! # SlideScript parses its calc functions using floating points, so you can # handle decimal as well calc "1024 * 1024" | calc "%PIPE% * %PIPE%" # Decimal print "Here comes the decimal:" calc "46 / 3.4" # Execute function, SS can call unix system calls! # Executes the ss_exec_command variable data, 'ls' print "Testing exec function on system" exec "%ss_exec_command%"