Introduction
Utah is a tool that allows you to write shell scripts in a strongly typed, TypeScript-inspired language (.shx). It then transpiles .shx code into clean, standard .sh bash scripts.
📦 File Extension: .shx
Quick Start
Get started with Utah in seconds:
- 
Install Utah CLI:
curl -sL https://utahshx.com/install.sh | sudo bash - 
Write your first
.shxscript:const message: string = "Hello, Utah!";
console.log(message); - 
Compile and run:
utah compile hello.shx
./hello.sh... or run directly:
utah hello.shx 
Key Features
🎯 Type Safety
Write shell scripts with TypeScript-like syntax including type annotations, variables, and function declarations.
🔄 Modern Language Features
- Import system for modular code organization
 - Error handling with try/catch blocks
 - Control flow (for/while loops, switch statements)
 - Array manipulation and string functions
 
🧩 Rich Built-in Functions
- File system operations
 - JSON/YAML processing with jq/yq integration
 - Web requests and API interactions
 - Process management and system information
 - Git utilities and DevOps automation
 
⚡ Parallel Execution
Execute functions in parallel for improved performance with the parallel keyword.
📦 Dependency Management
Automatic installation and verification of required tools like jq, yq, and other utilities.
📋 Command-Line Arguments
Built-in argument parsing with type safety:
- Define arguments with 
args.define()including types, defaults, and descriptions - Automatic help generation with 
args.showHelp() - Type-safe argument access with 
args.get()andargs.has() - Required and optional argument support
 
🛠️ Developer Tools
- VS Code Extension: Full IDE integration with syntax highlighting and IntelliSense
 - Language Server: Real-time error checking and code completion
 - Code Formatting: Automatic formatting with EditorConfig support
 
📝 Script Metadata
- Script descriptions with 
script.description() - Error handling modes with 
script.exitOnError() - Debug output control with 
script.enableDebug() - Fault tolerance options
 
Example
Input (example.shx):
const appName: string = "MyApp";
let users: string[] = ["Alice", "Bob", "Charlie"];
function greet(name: string): void {
  console.log("Hello, ${name}! Welcome to ${appName}.");
}
for (let user: string in users) {
  greet(user);
}
// Check if git is available
if (os.isInstalled("git")) {
  console.log("Git is available for version control");
} else {
  console.log("Please install git");
}
Output (example.sh):
#!/bin/bash
readonly appName="MyApp"
users=("Alice" "Bob" "Charlie")
greet() {
  local name="$1"
  echo "Hello, ${name}! Welcome to ${appName}."
}
for user in "${users[@]}"; do
  greet "${user}"
done
gitInstalled=$(command -v "git" &> /dev/null && echo "true" || echo "false")
if [ "${gitInstalled}" = "true" ]; then
  echo "Git is available for version control"
else
  echo "Please install git"
fi
How It Works
- Parse: Utah parses your 
.shxfile using a custom parser into an Abstract Syntax Tree (AST) - Analyze: The AST is analyzed for type safety and language features
 - Transpile: The AST is transpiled into clean, readable bash code
 - Execute: The generated 
.shfile can be executed on any POSIX-compliant system 
Documentation Sections
Language Reference
- Arrays
 - Console Functions
 - Control Flow
 - Defer Statements
 - Error Handling
 - File System Functions
 - Functions
 - Git Functions
 - Import System
 - JSON and YAML Processing
 - Operating System Functions
 - Strings
 - System Functions
 - Template Functions
 - Utility Functions
 - Variables and Types
 - Web Functions
 
CLI Reference
Guides
- Development Guides
 - Parallel Execution
 - Testing Scripts
 - CI/CD Integration
 - DevOps Automation
 - Best Practices
 
Getting Started
Community and Support
- GitHub: polatengin/utah
 - Issues: Report bugs or request features
 - Discussions: Community discussions
 
License
Utah is open source software licensed under the MIT License.