dryLang
docsplaygrounddownloadgithub

Getting Started

  • Home
  • Getting Started
  • Setup

Language Basics

  • Variables
  • Types
  • Operators
  • Comments
  • Strings

Control Flow

  • Control Flow
  • Loops

Advanced Concepts

  • Functions
  • Structs
  • Collections
  • Modules
  • HTTP Server
  • Database

Reference

  • Built-ins
  • Error Handling
  • Errors

Examples

  • Hello
  • Variables
  • Functions
  • Control Flow
  • Structs
  • Arrays Maps
  • Try Err
  • Imports
  • Math
  • Strings
  • Http Server
  • Database
  • File Io

Templates

  • Automation
  • Cli Tool
  • Crud
  • Fetch Json
  • File Server
  • Hello
  • Html Render
  • Rest Api
Docs Menu

Getting Started

  • Home
  • Getting Started
  • Setup

Language Basics

  • Variables
  • Types
  • Operators
  • Comments
  • Strings

Control Flow

  • Control Flow
  • Loops

Advanced Concepts

  • Functions
  • Structs
  • Collections
  • Modules
  • HTTP Server
  • Database

Reference

  • Built-ins
  • Error Handling
  • Errors

Examples

  • Hello
  • Variables
  • Functions
  • Control Flow
  • Structs
  • Arrays Maps
  • Try Err
  • Imports
  • Math
  • Strings
  • Http Server
  • Database
  • File Io

Templates

  • Automation
  • Cli Tool
  • Crud
  • Fetch Json
  • File Server
  • Hello
  • Html Render
  • Rest Api

Automation

drylang
// template: automation
// desc: Basic system automation script (executing shell commands, file io)

pt "--- System Automation Script ---"

 // Get current user from env
user = env("USERNAME")
if len(user) = 0 {
    user = env("USER") // Linux/Mac fallback
}
pt "Running as: ${user}"

 // Create a backup folder
backup_dir = "./backup_" + str(now())
pt "Creating backup directory: ${backup_dir}"
cmd("mkdir", backup_dir)

 // Write a log file
log_file = backup_dir + "/run.log"
w(log_file, "Backup started at " + date()["format"])

 // List current directory
files = dir(".")
pt "Found ${len(files)} files/folders."

 // Process files
lp len(files) {
    f = files[i]
    if has(f, ".txt") {
        pt "Found text file: ${f}"
         // In a real script, you might copy it using cmd("cp", f, backup_dir)
    }
}

pt "Automation complete!"
PreviousFile IoNextCli Tool