ฉันมีปัญหาเดียวกันวันนี้และตรวจสอบโปรแกรม rmtrash ที่ระบุไว้ด้านบนด้วย น่าเสียดายที่โซลูชันทั้งหมดที่เห็นจะย้ายไฟล์ไปที่. trash ของโฮมไดเรกทอรี
ตัวค้นหาในอีกทางหนึ่งจะย้ายไปยังโฟลเดอร์ -Trash ที่แตกต่างกันตามจุดเชื่อมต่อของระบบไฟล์ของไฟล์
ดังนั้นวิธีที่ง่ายที่สุดที่ฉันจะได้รับ (สร้างใน 10.5.8 เพื่อทำการทดสอบในเวอร์ชั่นใหม่กว่าของ OS X) คือ:
osascript -e 'tell application "Finder" to delete POSIX file "'FULL FILENAME HERE'"'
นี่คือเชลล์สคริปต์ที่ฉันสร้างขึ้น:
#!/bin/bash
declare -a files
for f in "$@" ; do
    if [ -r "$f" ] ; then
        case "$f" in
        /*) ;;
        *) f="$( pwd )/$f" ;;
        esac
        files=("${files[@]}" "$f")
    else
        echo "Can't find '$f'" >&2
    fi
done
if [ ${#files[@]} -gt 0 ] ; then
    osascript -e '
    on run argv
        repeat with f in argv
            set x to (POSIX file f) as string
            tell application "Finder" to delete x
        end
    end
    ' "${files[@]}" > /dev/null
fi