में (टी) csh, set
एक चर को परिभाषित करने के लिए किया जाता है; set foo = bar
वैरिएबल foo
(जैसे foo=bar
बोर्न शेल स्क्रिप्टिंग में करता है) के लिए bar
मान असाइन करेगा)।
किसी भी मामले में, tcsh(1)
से:
Argument list processing
If the first argument (argument 0) to the shell is `-' then it is a
login shell. A login shell can be also specified by invoking the shell
with the -l flag as the only argument.
The rest of the flag arguments are interpreted as follows:
[...]
-e The shell exits if any invoked command terminates abnormally or
yields a non-zero exit status.
तो तुम -e
ध्वज के साथ tcsh
आह्वान करने के लिए की जरूरत है। के परीक्षण करते हैं:
% cat test.csh
true
false
echo ":-)"
% tcsh test.csh
:-)
% tcsh -e test.csh
Exit 1
वहाँ sh
के set -e
साथ की तरह, कार्यावधि में यह स्थापित करने के लिए कोई रास्ता नहीं है, लेकिन आप hashbang में जोड़ सकते हैं:
#!/bin/tcsh -fe
false
तो यह स्वचालित रूप से जोड़ा जाता है आप ./test.csh
चलाते हैं, लेकिन इस नहीं जोड़ देगा जब आप csh test.csh
टाइप करें, तो मेरी सिफारिश एक start.sh
की तरह कुछ जो csh
स्क्रिप्ट लागू करेगा उपयोग करने के लिए है:
#!/bin/sh
tcsh -ef realscript.csh
क्या आपने इसे आजमाया? अन्यथा आपने 'मैन टीसीएसएच' की जांच की? सौभाग्य। – shellter
जब मैं सेट-ए को खोल में उपयोग करता हूं, तो मुझे यह त्रुटि मिली: सेट: परिवर्तनीय नाम एक अक्षर से शुरू होना चाहिए। – ARM
मैन पेज को देखते हुए, मुझे लगता है कि आपको इसका उपयोग '#!/Bin/tcsh -e ... '(फ़ाइल के शीर्ष पर) के रूप में करना होगा। सौभाग्य। – shellter