ฉันได้อ่าน man page และข้อมูลอ้างอิงอื่น ๆ แล้ว แต่ฉันยังสับสนกับพฤติกรรมการค้นหาพร้อม-print0
ตัวเลือก
-print0 This primary always evaluates to true. It prints the pathname of
the current file to standard output, followed by an ASCII NUL
character (character code 0).
คำสั่งแรก:
$ find /some/path/ -iname "*intro*jpeg" -o -iname "*intro*jpg" 2> /dev/null
/some/path//asdf199Intro-5kqlw.jpeg
/some/path/199intro-2jjaj.JPEG
/some/path/199intro-3.jpg
/some/path/wuer199intro-4.JPG
/some/path/xbzf199INTRO-1.jpg
คำสั่งที่สอง:
$ find /some/path/ -iname "*intro*jpeg" -o -iname "*intro*jpg" 2> /dev/null -print0
/some/path/136intro-3.jpg/some/path/wuer136intro-4.JPG/some/path/xbzf136INTRO-1.jpg
ฉันเห็นได้ว่าชื่อไฟล์จากคำสั่งที่สองแยกจากกันเป็นโมฆะ แต่ทำไมฉันถึงได้ 3 เอาต์พุตเมื่อเทียบกับ 5 ด้านบน
1
เทคนิคที่พวกเขากำลัง null ยกเลิกไม่ null แยกออกจากกัน (มี NUL ทุกครั้งหลังจากพา ธ รวมถึงคนสุดท้ายคือ.)
—
CJM