linux - unable to get the $expect_out(buffer) and $expect_out(0,string) values in shell with expect -


यदि मैं शेल लिपि में उम्मीद करता हूं, तो मैं $ expect_out (बफर) और $ expect_out (0 , स्ट्रिंग)।

नीचे दिए गए नमूना कोड हैं जिन्हें मैं कोडित करता हूं।

  [लिनक्स देव: अपनैमन =] $ cat expshl.sh #! / bin / bash उम्मीद & लेफ्टिनेंट ; & lt; ईओएफ स्पॉन "/ होम / अपनैमन / एक्सटेक्टेको।" अपेक्षित {"हाय" {send_user "आप ने कहा था $ $ expect_out (बफ़र) \ n"; send_user "स्टिंग $ expect_out (0, स्ट्रिंग) \ n" बाहर निकलें 1} "* bd *" {send_user "आपने कहा था कि $ expect_out (बफ़र) \ n" send_user "स्टिंग $ expect_out (0, स्ट्रिंग) \ n" बाहर निकलें 2} टाइमआउट {send_user "टाइमआउट \ n"; बाहर निकलना 3}} ईओएफ [लिनक्स देव: अपनिमैन]] $ cat expectecho.sh "नमस्ते" गूंज गूंजती "abduls" प्रतिध्वनि "theos" गूंज "यह abdul है" [लिनक्स देव: upncommn ~] $ ./expshl.sh spawn / home / upncommn / expectecho.sh नमस्कार abduls theos आप ने कहा (बफर) स्टिंग (0, स्ट्रिंग) [लिनक्स देव: अपनॉमन ~] $ $ गूंज? 2   

कृपया $ expect_out (बफर) और $ expect_out (0, स्ट्रिंग) प्राप्त करने में मेरी मदद करें।

शैल heredocs अनिवार्य रूप से बड़े डबल उद्धृत स्ट्रिंग हैं शेल $ expect_out चर (एक रिक्त स्ट्रिंग के साथ है, क्योंकि शेल सत्र में ऐसा कोई चर नहीं है) इससे पहले उम्मीद की शुरुआत हो जाती है खोल से अपेक्षित चर की रक्षा के लिए आपको अपेक्षित स्क्रिप्ट निकाय को एकल-उद्धरण की आवश्यकता है:

  उम्मीद & lt; & lt; 'ईओएफ' # ........ ^ ... ^ # बाकी सब एक ही है   



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -