bash: read a file content into a variable, the content contains special characters: `*` -


मेरे पास content.txt नाम की एक फ़ाइल है:

  $ Cat content.txt   

आउटपुट:

  * 1 2   

एक ही निर्देशिका में, मेरे पास Bash फ़ाइल: read.sh को content.txt

  $ cat read.sh की सामग्री पढ़ने के लिए   

आउटपुट:

  content = 'cat content.txt` प्रतिध्वनि $ सामग्री   

जैसा कि हम देख सकते हैं कि एक * < / Code> में content.txt । इसलिए, जब मैं reah.sh चलाता हूं:

  $ sh read.sh   

आउटपुट:

  content.txt read.sh 1 2   

ऐसा लगता है कि, * पार्स किया गया है।

कैसे प्राप्त कर सकते हैं content.txt की सामग्री? कोई भी मदद महान होगी।

* चरित्र एक वाइल्डकार्ड वर्ण है Globbing जो वर्तमान निर्देशिका में फाइल नामों को विस्तृत करता है और यदि आप गूंज केवल चरित्र चाहते हैं तो उद्धृत किया जाना चाहिए या बच चाहिए।

आप एक फ़ाइल से पढ़ें builtin कमांड।

  सामग्री पढ़ें; क्या "$ सामग्री" को किया गया है & lt; Content.txt    

Comments

Popular posts from this blog

sonata admin - how to add ManyToOne property field in configureListfield in sonataAdmin -

wpf - ControlTemplate with changes for every class -

python - how we can use ajax() in views.py in django? -