Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
trayopen [2013/07/13 15:57] beandog |
trayopen [2014/02/16 19:41] (current) beandog |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== trayopen ====== | + | ====== trayopen (archives) ====== |
+ | |||
+ | I wrote a similar program in C that does the same thing, but with more states. See [[dvd_drive_status]]. | ||
+ | |||
+ | ==== Archives ==== | ||
This code has been a lifesaver to me when it comes to checking to see if a tray is open or not. Believe it or not, there's nothing good out there to query it! (And I've looked, too.) | This code has been a lifesaver to me when it comes to checking to see if a tray is open or not. Believe it or not, there's nothing good out there to query it! (And I've looked, too.) | ||
Line 50: | Line 54: | ||
#!/bin/bash | #!/bin/bash | ||
trayopen /dev/dvd | trayopen /dev/dvd | ||
- | if [[ $! -eq 0 ]]; then | + | if [[ $? -eq 0 ]]; then |
echo "Open for business!" | echo "Open for business!" | ||
- | elif [[ $! -eq 1 ]]; then | + | elif [[ $? -eq 1 ]]; then |
echo "Sorry, already occupied." | echo "Sorry, already occupied." | ||
fi | fi | ||
</code> | </code> |