-
Notifications
You must be signed in to change notification settings - Fork 0
Environment Variables
Mikhail Deynekin edited this page Apr 11, 2026
·
1 revision
Complete reference for all environment variables supported by sr.
- Command-line arguments (highest priority)
-
Environment variables (
SR_*) - Script defaults (lowest priority)
| Variable | Default | Description |
|---|---|---|
SR_DEBUG |
false |
Enable debug output |
SR_DRY_RUN |
false |
Test mode without modifications |
SR_NO_BACKUP |
false |
Disable backup creation |
SR_FORCE_BACKUP |
false |
Force backup even when no changes |
SR_MAX_DEPTH |
100 |
Maximum directory recursion depth |
SR_VERBOSE |
false |
Enable verbose output |
| Variable | Default | Description |
|---|---|---|
SR_MAX_FILE_SIZE_MB |
50 |
Skip files larger than this (MB) |
SR_BINARY_CHECK_SIZE |
2048 |
Bytes to check for binary detection |
SR_MAX_BACKUPS |
20 |
Maximum number of backup sessions to keep |
| Variable | Default | Description |
|---|---|---|
SR_IGNORE_CASE |
false |
Case-insensitive matching |
SR_EXTENDED_REGEX |
false |
Use extended regular expressions |
SR_WORD_BOUNDARY |
false |
Match whole words only |
SR_GLOBAL_REPLACE |
true |
Replace all occurrences per line |
| Variable | Default | Description |
|---|---|---|
SR_FIND_FLAGS |
"" |
Default flags for find command |
SR_SED_FLAGS |
"" |
Default flags for sed command |
SR_GREP_FLAGS |
"-F" |
Default flags for grep command |
# Enable verbose and limit depth
export SR_VERBOSE=true
export SR_MAX_DEPTH=5
export SR_MAX_FILE_SIZE_MB=10
# Now all sr commands use these defaults
sr "*.conf" "old-value" "new-value"# Configure grep to skip comment lines
export SR_GREP_FLAGS="-v '^#'"
# Enable extended regex by default
export SR_EXTENDED_REGEX=true
# Use custom find flags
export SR_FIND_FLAGS="-type f -mtime -7"# Production safety settings
export SR_MAX_FILE_SIZE_MB=10
export SR_NO_BACKUP=false
export SR_FORCE_BACKUP=true
export SR_MAX_BACKUPS=30
export SR_MAX_DEPTH=10#!/bin/bash
# File: /usr/local/bin/sr-project
# Project-specific sr configuration
export SR_MAX_DEPTH=3
export SR_NO_BACKUP=false
export SR_VERBOSE=true
export SR_EXCLUDE_DIRS="node_modules,dist,.git"
/usr/local/bin/sr "$@"| Variable | Default | Description |
|---|---|---|
SR_EXCLUDE_DIRS |
.git,node_modules |
Comma-separated directories to exclude |
SR_EXCLUDE_PATTERNS |
"" |
File patterns to exclude |
SR_ALLOW_HIDDEN |
false |
Process hidden files/directories |
SR_ALLOW_BINARY |
false |
Allow binary file processing |
SR_BINARY_DETECTION_METHOD |
multi_layer |
Binary detection: multi_layer, file_only, grep_only
|
- Tool Configuration - Tool-specific configuration
- Command Reference - Complete option listing
- Security Hardening - Security best practices