75 lines
2.6 KiB
Scheme
Executable File
75 lines
2.6 KiB
Scheme
Executable File
#!/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=echo SS executing echo from system shell
|
|
|
|
# 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!
|
|
encrypt "%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
|
|
|
|
# Read md5 file
|
|
read "%ss_filename%.md5"
|
|
|
|
# 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"
|
|
# Gone!
|
|
|
|
print("Testing execution functions");
|
|
sleep 1
|
|
|
|
# Execute function, SS can call unix system calls!
|
|
# Executes the ss_exec_command variable data, 'ls'
|
|
exec "%ss_exec_command%"
|