YUM के साथ खोज करना
आप आमतौर पर किसी भी नियमित अभिव्यक्ति (ग्लब्स) का उपयोग नहीं करते हैं, yum searchक्योंकि कमांड searchपहले से ही पैकेज नामों और उनकी सारांश के भीतर उप-स्ट्रिंग की तलाश कर रहा है। मुझे इसके बारे में कैसे पता है? एक संदेश है जो आपको यह बताता है कि आप कब उपयोग करते हैं yum search।
नाम और सारांश केवल मेल खाते हैं, हर चीज के लिए "सभी खोजें" का उपयोग करें।
नोट: स्ट्रिंग [cl-*]तकनीकी रूप से बैश शेल में एक ग्लोब है।
तो आप आम तौर पर उन स्ट्रिंग्स के टुकड़ों की तलाश करते हैं जो आप चाहते हैं search। जब आप विशेष पैकेज की तलाश में होते हैं, तो नियमित अभिव्यक्तियाँ खेल में आती हैं। ये YUM कमांड हैं जैसे listऔर install।
उदाहरण के लिए:
$ yum list cl-* | expand
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.dmacc.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.dmacc.net
Available Packages
cl-asdf.noarch 20101028-5.fc19 fedora
cl-clx.noarch 0.7.4-4.3 home_zhonghuaren
cl-ppcre.noarch 2.0.3-3.3 home_zhonghuaren
एकमात्र कैगीट जो आपको रेगेक्स / ग्लब्स के साथ सावधान रहना है, अगर आपके शेल के भीतर फाइलें हैं जो इस तरह नामित हैं कि वे भी मेल खाएंगे cl-*। उन मामलों में आपका शेल यम को प्रस्तुत किए जाने से पहले रेगेक्स / ग्लोब का विस्तार करेगा।
तो दौड़ने के बजाय yum list cl-*आप कमांड चला रहे होंगे yum list cl-file, अगर वहाँ कोई फ़ाइल regex / glob से मेल खाती हो cl-*।
उदाहरण के लिए:
$ ls cl-file
cl-file
$ yum list cl-*
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.steadfast.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.steadfast.net
Error: No matching Packages to list
वाइल्डकार्ड से बचकर आप ऐसा कर सकते हैं।
$ yum list cl-\* | expand
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.dmacc.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.dmacc.net
Available Packages
cl-asdf.noarch 20101028-5.fc19 fedora
cl-clx.noarch 0.7.4-4.3 home_zhonghuaren
cl-ppcre.noarch 2.0.3-3.3 home_zhonghuaren
तो कोष्ठक के बारे में क्या
मुझे संदेह है कि आपके पास अपनी स्थानीय निर्देशिका में फाइलें हैं जो कि आपके द्वारा [cl-*]तर्क के रूप में उपयोग किए जाने पर मेल खा रही हैं yum search। शेल द्वारा मिलान किए जाने के बाद इन फ़ाइलों को उस yum searchकमांड में पास किया गया, जहां मैच तब मिले थे।
उदाहरण के लिए:
$ ls cl-file
cl-file
$ yum search cl-*
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.dmacc.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.dmacc.net
======================================================================= N/S matched: cl-file =======================================================================
opencl-filesystem.noarch : OpenCL filesystem layout
Name and summary matches only, use "search all" for everything.
नोट: ऊपर दिया गया मिलान मेरी फ़ाइल के नाम से मेल खाता था cl-file, न कि cl-*जैसा मैंने इरादा किया था।
cl-*, यह एक नियमित अभिव्यक्ति नहीं है, लेकिन यह एकglobया एक टिप्पणी है । यह एक नियमित भाषा है (चॉम्स्कियन शब्दों में), लेकिन हम आमतौर पर कहते हैं कि कुछ एक नियमित अभिव्यक्ति है यदि यह नियमित भाषा के लिए एक व्याकरण को परिभाषित करता है (कम से कम तीन बुनियादी कार्यों का उपयोग करके: समाकलन, परिवर्तन और क्लेन स्टार)।