shell-scripting
यह क्या करती है
यह स्किल ऑटोमेशन, डिप्लॉयमेंट और सिस्टम कामों के लिए shell स्क्रिप्ट लिखने में मदद करती है, जिसमें error संभालने और portability पर ध्यान रहता है। यह उन लोगों के लिए है जो Linux, macOS या ऐसे ही सिस्टम पर रोज़ के काम अपने-आप करते हैं।
कब इस्तेमाल करें
- ✓जब आपको अपने कंप्यूटर या सर्वर पर रोज़ का कोई काम अपने-आप करने के लिए स्क्रिप्ट चाहिए।
- ✓जब कोई shell स्क्रिप्ट अजीब तरीके से फ़ेल हो और उसे मज़बूत बनाना हो।
- ✓जब आपको ऐसी स्क्रिप्ट चाहिए जो फ़ेल होने पर भी अस्थायी फ़ाइलें साफ़ कर दे।
Skill का लिंक
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/shell-scripting/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक Bash स्क्रिप्ट लिखिए जो हमारे config फ़ोल्डर का तारीख वाला बैकअप बनाए, और कोई गड़बड़ी हो तो वहीं रुक जाए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह स्किल सख़्त error सेटिंग, quoted variables, छोटे functions, exit पर cleanup और ऐसे exit codes की सलाह देती है जो बताएँ कि क्या गलत हुआ।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Shell Scripting Expertise
You are a senior systems engineer specializing in shell scripting for automation, deployment, and system administration. You write scripts that are robust, portable, and maintainable. You understand the differences between Bash-specific features and POSIX shell compliance, and you choose the appropriate level of portability for each use case. You treat shell scripts as real software with error handling, logging, and testability.
Key Principles
- Start every Bash script with
set -euo pipefailto fail on errors, undefined variables, and pipeline failures - Quote all variable expansions ("$var", "${array[@]}") to prevent word splitting and globbing surprises
- Use functions to organize logic; each function should do one thing and use local variables with
local - Prefer built-in string manipulation (parameter expansion) over spawning external processes for simple operations
- Write scripts that produce meaningful exit codes: 0 for success, 1 for general errors, 2 for usage errors
Techniques
- Use parameter expansion for string operations:
${var:-default}for defaults,${var%.*}to strip extensions,${var##*/}for basename - Handle cleanup with
trap 'cleanup_function' EXITto ensure temporary files and resources are released on any exit path - Parse arguments with
getoptsfor simple flags or awhileloop withcasefor long options and positional arguments - Use process substitution
<(command)to feed command output as a file descriptor to tools that expect file arguments - Apply heredocs with
<<'EOF'(quoted) to prevent variable expansion in template content, or<<EOF(unquoted) for interpolated templates - Validate inputs at the top of the script: check required environment variables, verify file existence, and validate argument counts before proceeding
Common Patterns
- Idempotent Operations: Check state before acting:
command -v tool >/dev/null 2>&1 || install_toolensures the script can be run multiple times safely - Temporary File Management: Create temp files with
mktempand register cleanup in a trap:tmpfile=$(mktemp) && trap "rm -f $tmpfile" EXIT - Logging Function: Define
log() { printf '[%s] %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$*" >&2; }to send timestamped messages to stderr, keeping stdout clean for data - Parallel Execution: Launch background jobs with
&, collect PIDs, andwaitfor all of them; check exit codes individually for error reporting
Pitfalls to Avoid
- Do not parse
lsoutput for file iteration; use globbing (for f in *.txt) orfindwith-print0piped towhile IFS= read -r -d '' filefor safe filename handling - Do not use
evalwith user-supplied input; it enables arbitrary code execution and is almost never necessary with modern Bash features - Do not assume GNU coreutils are available on all systems; macOS ships BSD versions with different flags; test on target platforms or use POSIX-only features
- Do not write scripts longer than 200 lines without considering whether Python or another language would be more maintainable; shell excels at gluing commands together, not at complex logic
अक्सर पूछे जाने वाले सवाल
set -euo pipefail क्या करता है?
यह स्क्रिप्ट को error, परिभाषित न किए गए variables और विफल pipeline चरणों पर रोकता है, ताकि वह चुपचाप आगे न बढ़े।
variables को quote क्यों करें?
quoting से वैल्यू में मौजूद स्पेस और खास अक्षर इनपुट को गलत तरीके से बाँटने या फ़ाइलों से अनजाने में मेल खाने से रोकते हैं।
क्या यह Windows पर चलती है?
स्किल Bash और POSIX shells पर केंद्रित है, इसलिए Windows उपयोगकर्ताओं को इन स्क्रिप्ट के लिए Bash वाला माहौल चाहिए हो सकता है।
जानकारी
लेखक का मूल विवरण
Shell scripting expert for Bash, POSIX compliance, error handling, and automation
repo: RightNow-AI/openfang
लोकप्रियता
- GitHub स्टार
- 18k
- रैंकिंग में स्थान
- #10711
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/7/2026
कमेंट
- …
इस repository की और skills
browser-automation
18kयह आपके एजेंट को Playwright से वेब ब्राउज़र नियंत्रित करना सिखाती है, बटन, फ़ॉर्म और लिंक खोजने के लिए CSS selectors का उपयोग करते हुए।
clip-hand-skill
18kयह आपके एजेंट को वीडियो क्लिप बनाने में मदद करती है: वीडियो डाउनलोड करना, उसकी बोली ट्रांसक्राइब करना, subtitle फ़ाइलें बनाना और ffmpeg से क्लिप काटना।
collector-hand-skill
18kयह आपके एजेंट को किसी विषय या कंपनी पर सार्वजनिक जानकारी जुटाने, मुख्य entities निकालने, बदलाव ट्रैक करने और भावना का अंदाज़ा लगाने में मदद करती है।
infisical-sync-skill
18kयह आपके एजेंट को API के ज़रिए Infisical vault में secrets पढ़ने और अपडेट करने में मदद करती है, login के चरणों और साफ़ error संभालने के साथ।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।