From owner-freebsd-questions@FreeBSD.ORG Tue Oct 29 14:51:30 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4D3B1ED3 for ; Tue, 29 Oct 2013 14:51:30 +0000 (UTC) (envelope-from jerry@seibercom.net) Received: from mail-qc0-x232.google.com (mail-qc0-x232.google.com [IPv6:2607:f8b0:400d:c01::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F02C32C3C for ; Tue, 29 Oct 2013 14:51:29 +0000 (UTC) Received: by mail-qc0-f178.google.com with SMTP id x19so4755739qcw.9 for ; Tue, 29 Oct 2013 07:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seibercom.net; s=google; h=date:from:to:subject:message-id:in-reply-to:references:reply-to :organization:face:mime-version:content-type :content-transfer-encoding; bh=gaqNuHi6rF8tbsbA//YUW40m5BjCCxDJ+JgtDYOYenU=; b=VE42X3g5bTnxJaTKApP29/24W05sErEEd+U0Vnzn9O5avBmS14V/rYFaoqKkxCZrgi 8u9xIOId5ytBuOuqjqREFV9ASFragI9b4afPWAabjN5XYQe0ZxYONVTjsxIR5+iVp+Uw fwn1GDJMDRm3zEZmT6OPsSVSFpHkM6QSfsdY4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:reply-to:organization:face:mime-version:content-type :content-transfer-encoding; bh=gaqNuHi6rF8tbsbA//YUW40m5BjCCxDJ+JgtDYOYenU=; b=UxjY2PUFpgLIPbOzvahwCsm7btYK/sCPzFNEfuNvQm2HKf8xV0WttZBm07MNrr/W3G hOW4lI3LJ/0dvGi9kectuQgjyNv4CUMXmoH1BHIz4L3Z7JDiQqSnhW5TKEbohclLWn5n CbXdY7dIPDAuQeppvSvvSZangxUp65nze663N6o6J3uyqH1nNF4fobFTuoSh2gFPp4z/ cwu4IsddJLLDdjSXNDB4FO689OtpScGRB1RDabikak/koUlSLOoVUjfYoo+qpitgrWU8 hE3arFy+m+SgZU13zCmHtVTwdiipgCGuhwF5c4CEug1SzLoQAa0er9bEzUCdpHFMk11S U7+Q== X-Gm-Message-State: ALoCoQn5FDogWY/u7XYL+wEI67Sgh/Qku11kFPhNA5tM54DUWjWzH2Gcamm15aYB3WDM8Kwhht5e X-Received: by 10.49.40.133 with SMTP id x5mr10809qek.52.1383058288831; Tue, 29 Oct 2013 07:51:28 -0700 (PDT) Received: from scorpio.seibercom.net (cpe-076-182-104-150.nc.res.rr.com. [76.182.104.150]) by mx.google.com with ESMTPSA id h6sm54732425qej.4.2013.10.29.07.51.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Oct 2013 07:51:28 -0700 (PDT) Received: from scorpio (localhost [127.0.0.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jerry@seibercom.net) by scorpio.seibercom.net (Postfix) with ESMTPSA id 3d8G2k5TmKz2CG4w for ; Tue, 29 Oct 2013 10:51:26 -0400 (EDT) Date: Tue, 29 Oct 2013 10:51:26 -0400 From: Jerry To: FreeBSD Subject: Re: Check to see if share is mounted Message-ID: <20131029105126.0858ba0d@scorpio> In-Reply-To: <20131029125508.a7525980.freebsd@edvax.de> References: <20131029074019.5a7a75b9@scorpio> <20131029125508.a7525980.freebsd@edvax.de> Organization: seibercom.net X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.19; amd64-portbld-freebsd8.3) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEUAAABYRlwJCw4FAgAIBwKprDkBAQFQLR0BAgCir7VRttp8AAACAUlEQVQ4jZWUTYvbMBCGTVl8V2hX6Gg5G5FbWQdBj0lEfE7BhN4cyzi5Wt1E5L70roWy6N92xok/skkP+5IYrMcz78xIduDWpNM3vFzuA/jX5EY1AI6KHFwW/CzFuQAwqUBbV12p+CzIh6Awq7sg33pn5D64SQXAexffeuQlA/L35RrkaB551OjGfP/cAO8mCNaDcgvfky5ijoD0pAXlCQCnljiAjsJD9Ax05Ko5sZxbnLQcmM+dZg5IjREfZrWIHK0JuwU68pAGwHvfRxBundRzTxxz3r9dNUikPsEihjz2Dc4kjp1hKsJGuot4EDxaxzMoC7XqhxhOSfZrTS6gSX1JVdjp+o1PvWfekXgw3WL0g70nDEwA0H0HQsEZc8sTmFMTkWUfYWC/vdR1zQy3xLQgLwzu90QnlnFLjeiGWBjwhb4Sa42IqOg2qqS4O1/zhKokFUb1Q8Rj4Eb69WVflXEehJ35DgChVTE5n50eaGyMLOfH8AOodoSM4PVYAQgQdBulOa+knklYks3vAuQ+uX492lTl+A+e8qBV2AKoXalVKFfyuUp0pUp1ARaUHh82lv9MN+Ig7CZtgE6FNYvjlywT2VP2dMgOG46gTIWcqdfvuwyXNz0oMJNd/N5lh1YNiJt19ADTUo3VuFSNeQwVqRSrGjSCp53fk2g+Mvfk/gfoPxHeUS8MH9vRAAAAAElFTkSuQmCC Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: FreeBSD List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 14:51:30 -0000 On Tue, 29 Oct 2013 12:55:08 +0100 Polytropon articulated: > That's quite easy. Just query "df" and grep for the name of > the mountpoint or the CIFS name ("device field" as it appears > in /etc/fstab). Here's an example: > > if [ df | grep "/home/bob/stuff" ]; then > ... do stuff when share is mounted ... > else > echo "CIFS share not availble." > exit 1 > fi That doesn't work under Bash. I modified it and now it works fine. if ( df | grep 'Path_To_Mount' &>\dev\null ); then echo "It is mounted" else echo "Not mounted" fi -- Jerry ♔ Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __________________________________________________________________