2021-06-09 20:26:24 -07:00
<!DOCTYPE html>
< html lang = "en-US" >
< head >
< title > SlideScript API: File manipulation ~ The Lazy Language< / title >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< 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!" / >
< link href = "../style.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< table > < tr > < td >
< div class = "header" >
< img src = "../sslogo.png" class = "logoimg" title = "SlideScript logo" alt = "SlideScript" / >
< / div >
< / td > < / tr > < tr > < td >
< div class = "menu" > <!--
-->< a href = "../index.html" > Home< / a > <!--
-->< a href = "index.html" > Documentation< / a > <!--
-->< a href = "https://notabug.org/Pentium44/slidescript" > Git< / a > <!--
-->< / div >
< / td > < / tr > < / table >
< div class = "container" >
< p > If you're following through the API documentation, chapter by chapter,
then you have a good idea of the foundation of the language in terms
of it's structure. Now for some features of SlideScript. File manipulation
is definitely something that can be tackled without a doubt. A selection
of functions within SlideScript that are file related are: isfile, isdir,
showdir (ls), showpath (pwd), move (mv), delete, chdir (cd), read, write,
and cat.< br / > < br / >
To be honest, how could SlideScript be shell like without having the
functionality of all the system utilities. Here's the kicker, everything
is built-in to the core of SlideScript, making it extremely versatile and
super simple! No dependency on other software!
< pre > < code >
#!/usr/bin/slidescript
# File manipulation examples
# showdir: list directories/files in current directory.
# argument count: 0
# returns: file list.
showdir
ls # alias
# showpath: show current working directory location (alias pwd).
# argument count: 0
# returns: working directory path
showpath
pwd # alias
# chdir: Change directory
2021-06-09 22:35:19 -07:00
# argument count: 1, "path" ex: "docs/"; "/home/user"
2021-06-09 20:26:24 -07:00
# returns: No return
chdir "docs/"
showpath # Show return of change
# backdir: Back a directory / to parent directory (same as chdir "..")
# argument count: 0
# returns: No return
backdir
# isdir / isfile: Return true or false (0 or 1) on file / directory find.
2021-06-09 22:35:19 -07:00
# argument count: 1, "file/path" ex: "docs/README.txt"
2021-06-09 20:26:24 -07:00
# returns: true / false
isfile "docs/README.txt" # returns: true
isdir "docs/" # returns: true
isfile "docs/" # returns: false
# move: move file / rename file based on arguments.
2021-06-09 22:35:19 -07:00
# argument count: 2, "original" "new file name/location", ex: "docs/" "documents/"
2021-06-09 20:26:24 -07:00
# returns: no return
move "docs" "documents" # renamed docs -> documents
# delete: delete file (non-recursive)
2021-06-09 22:35:19 -07:00
# argument count: 1, "filename", ex: "docs/README.txt"
2021-06-09 20:26:24 -07:00
# return: no return
delete "docs/README.txt" # deletes README.txt inside docs/
# read: read contents of file given to function
2021-06-09 22:35:19 -07:00
# argument count: 1, "file", ex: "docs/README.txt"
2021-06-09 20:26:24 -07:00
# return: contents of file
read "docs/README.txt" # Returns contents of "README.txt"
# write: write contents to file.
2021-06-09 22:35:19 -07:00
# argument count: 2, "filename" "contents", ex: "test.txt" "Hello world!"
2021-06-09 20:26:24 -07:00
# return: no return
write "test.txt" "Hello world!"
# cat: catenate file with given contents
2021-06-09 22:35:19 -07:00
# argument count: 2, "file" "contents", ex: "test.txt" "I'm back!"
2021-06-09 20:26:24 -07:00
# return: no return
cat "test.txt" "I'm back!" # catenates "I'm back!" to the end of the original test.txt "Hello world!"
# Ending file contents of "test.txt":
# Hello world!
# I'm back!
< / code > < / pre >
< / p >
< h3 > IRC server< / h3 >
< p >
Still need help? Want to report a bug? Join us!< br / > < br / >
IP/Port: cddo.cc/1337< br / >
Main hang channel: < b > #theroot< / b > < br / >
FreeBox channel: < b > #freebox< / b > < br / >
FreonLinux channel: < b > #freonlinux< / b >
< / p >
< / div >
< div class = "footer" >
© 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 / >
< p >
Powered by:< br / >
< a href = "https://freedns.afraid.org/" >
< img style = "width:100px;" src = "https://freedns.afraid.org/images/freedns_crop.png" / >
< / a >
< a href = "https://letsencrypt.org/" >
< img style = "width: 100px;" src = "https://letsencrypt.org/images/le-logo-wide.png" / >
< / a >
< a href = "http://jigsaw.w3.org/css-validator/check/referer" >
< img style = "border:0;width:80px" src = "http://jigsaw.w3.org/css-validator/images/vcss-blue" alt = "Valid CSS!" / >
< / a >
< / p >
< / div >
< / body >
< / html >