This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

if [ -w branching: how to spot a locked USB stick


This question isn't strictly Cygwin, but I hope it's OK to ask it in the context of Cygwin on a portable device eg a CD or a usb mobile drive or memory stick: the bash command

if [ -w /h ] ; then echo +W ; else echo -W ; fi

tests a device located at /h (or /cygdrive/h) for write-ability: eg a USB memory stick will echo +W and a CD will echo -W. If the stick is locked, however, you still get +W. Does anybody know whether bash has the capability to distinguish a locked stick from an unlocked stick, (through "if [ ..", or by other means) please?
Even better, if it could be used to distinguish between write-enabled and write-protected folders/ files.
Thank you.
Fergus



-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]