MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //lib/udev/check-cdrom.sh
#!/bin/bash

pos=0
n=0
sp="$1"
what="$2"
found=0

[ -e /proc/sys/dev/cdrom/info ] || exit 1

/bin/cat /proc/sys/dev/cdrom/info | { 
    while read line; do
	if [ "$found" = "0" -a "${line/drive name:}" != "$line" ]; then
	    set ${line/drive name:}	
	    while [ $# -gt 0 ]; do
		pos=$[$pos+1]
		if [ "$1" == "$sp" ]; then
		    found=1
		    break
		fi
		shift
	    done
	    [ "$found" = "0" ] && exit 1
	elif [ "${line/$what:}" != "$line" ]; then
	    set ${line##*$what:}	
	    while [ $# -gt 0 ]; do
		n=$[$n+1]
		if [ "$n" == "$pos" ]; then
		    if [ "$1" = "1" ]; then
			exit 0
		    fi
		    break
		fi
		shift
	    done
	fi    
    done
    exit 1
}