delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <469715CF.7090105@bonhard.uklinux.net> |
Date: | Fri, 13 Jul 2007 07:03:59 +0100 |
From: | fergus <fergus AT bonhard DOT uklinux DOT net> |
User-Agent: | Thunderbird 2.0.0.4 (Windows/20070604) |
MIME-Version: | 1.0 |
To: | Cygwin ML <cygwin AT cygwin DOT com> |
CC: | fergus <fergus AT bonhard DOT uklinux DOT net> |
Subject: | if [ -w branching: how to spot a locked USB stick |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |