chmod +x का उपयोग
एक नई script file एक locked toy box जैसी है, इसलिए computer इसके साथ नहीं खेलेगा जब तक आप permission न दें। chmod +x वह key है जो कहती है 'हां, इस file को run करने की अनुमति है'।
In this page:
Syntax
chmod +x file_name
./file_name
chmod +x
chmod +x file एक file में execute permission जोड़ता है, जो ./script.sh से एक script run करने से पहले ज़रूरी है। इसके बिना, shell एक "permission denied" error के साथ refuse करता है। यह एक नई script file बनाने के बाद एक one-time step है।
Warning:
chmod +x भूल जाना सबसे आम कारण है जिस वजह से एक नई script सीधे run नहीं होती।उदाहरण: chmod +x
# Check current permissions
ls -l script.sh
# Add execute permission for the owner
chmod +x script.sh
# Now it can be run directly
./script.sh
⚠️ Run this in your own terminal or Node.js environment.
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
chmod +xको गलत path पर run करना, इसलिए script अब भीPermission deniedदेती है।chmod 777उपयोग करना जबchmod +x(याchmod 755) काफी हो, जो file को everyone के लिए writable बना देता है।- यह भूल जाना कि कुछ file systems से copy की गई files execute bit खो देती हैं, इसलिए इसे फिर से set करना पड़ता है।
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: