Re: bash usage.

2017-11-05 Thread David Margerison
On 5 November 2017 at 19:17, wrote: > > Note that the mount(8) man page recommends findmnt(8) for script > usage. Findmnt is util-linux, so whether you want to use it or > not will depend a bit on your portability needs. > > Parsing mount output robustly is, of course, always a good exercise. Ah

Re: bash usage.

2017-11-05 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Nov 05, 2017 at 08:31:00AM +1100, David Margerison wrote: > On 5 November 2017 at 04:55, wrote: > > > What about checking whether the > > filesystem of a specific device is mounted at that directory? Can > > that be checked easily? > > It

Re: bash usage.

2017-11-04 Thread David Margerison
On 5 November 2017 at 08:31, David Margerison wrote: > > Demo example from an interactive bash command line on this PC: > > $ devname=/dev/sda6 ; dirname=/mnt/p/A ; if mount | grep -q -- > "$devname on $dirname" ; then echo "$devname is mounted on $dirname" ; > fi The above command is unclear bec

Re: bash usage.

2017-11-04 Thread David Margerison
On 5 November 2017 at 04:55, wrote: > What about checking whether the > filesystem of a specific device is mounted at that directory? Can > that be checked easily? It can be done by inspecting the output of the 'mount' command. But keep in mind that the detail of this output may not be stable

Re: bash usage.

2017-11-04 Thread peter
* From: Roberto C. Sánchez * Date: Wed, 25 Oct 2017 21:23:14 -0400 > The return status is seen by the shell as a numeric. ... * From: Kushal Kumaran * Date: Thu, 26 Oct 2017 07:01:30 +0530 > write it like this: ... See man test(1) for details. * From: David Margeri

Re: bash usage.

2017-10-26 Thread Jude DaShiell
2017 08:12:16 From: David Margerison To: "debian-user@lists.debian.org" Subject: Re: bash usage. Resent-Date: Thu, 26 Oct 2017 12:30:18 + (UTC) Resent-From: debian-user@lists.debian.org On 26 October 2017 at 21:59, Roberto C. S?nchez wrote: On Thu, Oct 26, 2017 at 04:19:42

Re: bash usage.

2017-10-26 Thread Roberto C . Sánchez
On Thu, Oct 26, 2017 at 11:12:16PM +1100, David Margerison wrote: > > That's a fair point, but the documentation of the 'if' statement in 'man bash' > will make that immediately clear to anyone who cares to read it. > You must regularly deal with different sorts of people than I do :-) > The [[

Re: bash usage.

2017-10-26 Thread David Margerison
On 26 October 2017 at 21:59, Roberto C. Sánchez wrote: > On Thu, Oct 26, 2017 at 04:19:42PM +1100, David Margerison wrote: >> On 26 October 2017 at 12:23, Roberto C. Sánchez wrote: >> > >> > mountpoint -q $WorkingDirectory >> > if [[ $? = 0 ]] >> >> That will work, but is ridiculous considering t

Re: bash usage.

2017-10-26 Thread Roberto C . Sánchez
On Thu, Oct 26, 2017 at 04:19:42PM +1100, David Margerison wrote: > On 26 October 2017 at 11:39, wrote: > > > > According to 'man mountpoint', it returns 0 if something is mounted. > > So why the complaint from > > if [ mountpoint $WorkingDirectory ] ? > > Answered here: > > http://mywiki.woo

Re: bash usage.

2017-10-25 Thread David Margerison
On 26 October 2017 at 11:39, wrote: > > According to 'man mountpoint', it returns 0 if something is mounted. > So why the complaint from > if [ mountpoint $WorkingDirectory ] ? Answered here: http://mywiki.wooledge.org/BashPitfalls#if_.5Bgrep_foo_myfile.5D http://mywiki.wooledge.org/BashGuid

Re: bash usage.

2017-10-25 Thread Kushal Kumaran
pe...@easthope.ca writes: > PROBLEM > Given a storage device, /dev/GRN, and mount point, /home/peter/testdir/, > determine in a shell script whether /dev/GRN is mounted or something is > mounted on /home/peter/testdir/. > > ATTEMPTED SOLUTION > Create testdir and execute this script. > > #!/bin/

Re: bash usage.

2017-10-25 Thread Roberto C . Sánchez
On Wed, Oct 25, 2017 at 05:39:35PM -0700, pe...@easthope.ca wrote: > > According to 'man mountpoint', it returns 0 if something is mounted. > So why the complaint from > if [ mountpoint $WorkingDirectory ] ? > The return status is seen by the shell as a numeric. It is not coerced to a bo

bash usage.

2017-10-25 Thread peter
PROBLEM Given a storage device, /dev/GRN, and mount point, /home/peter/testdir/, determine in a shell script whether /dev/GRN is mounted or something is mounted on /home/peter/testdir/. ATTEMPTED SOLUTION Create testdir and execute this script. #!/bin/bash # Demonstrate use of "mountpoint" in a

Re: Bash usage: was implicit linkage

2014-10-13 Thread Joel Rees
On Mon, Oct 13, 2014 at 10:53 PM, Chris Bannister wrote: > On Mon, Oct 13, 2014 at 02:10:11PM +0900, Joel Rees wrote: >> >> >> >> Which is another way of saying that you want others to have already made >> >> the mistakes for you. >> > >> > No it isn't! Ponder why most people take their car to a

Re: Bash usage: was implicit linkage

2014-10-13 Thread Chris Bannister
On Mon, Oct 13, 2014 at 02:10:11PM +0900, Joel Rees wrote: > >> > >> Which is another way of saying that you want others to have already made > >> the mistakes for you. > > > > No it isn't! Ponder why most people take their car to a mechanic for > > servicing. > > And you snipped: > > >> As long

Re: Bash usage: was implicit linkage

2014-10-12 Thread Joel Rees
On Mon, Oct 13, 2014 at 1:38 PM, Chris Bannister wrote: > On Mon, Oct 13, 2014 at 07:53:03AM +0900, Joel Rees wrote: >> 2014/10/13 2:14 "Andrei POPESCU" : >> > >> > On Du, 12 oct 14, 10:30:52, The Wanderer wrote: >> > > On 10/12/2014 at 10:07 AM, Andrei POPESCU wrote: >> > > >> > > > Any program t

Re: Bash usage: was implicit linkage

2014-10-12 Thread Chris Bannister
On Mon, Oct 13, 2014 at 07:53:03AM +0900, Joel Rees wrote: > 2014/10/13 2:14 "Andrei POPESCU" : > > > > On Du, 12 oct 14, 10:30:52, The Wanderer wrote: > > > On 10/12/2014 at 10:07 AM, Andrei POPESCU wrote: > > > > > > > Any program that requires additional scripting just to get it running > > > >

Re: Bash usage: was implicit linkage

2014-10-12 Thread Joel Rees
2014/10/13 2:45 "Steve Litt" : > > On Sun, 12 Oct 2014 09:33:43 +0100 > Martin Read wrote: > > > On 12/10/14 04:12, Peter Zoeller wrote: > > > But the nice > > > thing is shell scripting is simplistic easy to learn and understand. > > > > I refer the audience to David A. Wheeler's essay[1] on how

Re: Bash usage: was implicit linkage

2014-10-12 Thread Joel Rees
2014/10/13 2:14 "Andrei POPESCU" : > > On Du, 12 oct 14, 10:30:52, The Wanderer wrote: > > On 10/12/2014 at 10:07 AM, Andrei POPESCU wrote: > > > > > Any program that requires additional scripting just to get it running > > > is insufficiently advanced. > > > > > > (you can quote me on that) > > >

Re: Bash usage: was implicit linkage

2014-10-12 Thread Joel Rees
2014/10/12 23:07 "Andrei POPESCU" : > > On Sb, 11 oct 14, 21:40:49, Steve Litt wrote: > > > > From my viewpoint, shellscripts were never intended to be big, huge > > programs. To me, they just glue together commands, and have a few > > rudimentary branching and looping constructs. > > Isn't that li

Re: Bash usage: was implicit linkage

2014-10-12 Thread Steve Litt
On Sun, 12 Oct 2014 11:16:54 -0700 Don Armstrong wrote: > On Sun, 12 Oct 2014, Steve Litt wrote: > > This essay practically screams out for somebody to write a C program > > that takes an argument of an arbitrary string, finds all files in a > > directory, and returns a long string with those fil

Re: Bash usage: was implicit linkage

2014-10-12 Thread Ansgar Burchardt
Don Armstrong writes: > On Sun, 12 Oct 2014, Steve Litt wrote: >> This essay practically screams out for somebody to write a C program >> that takes an argument of an arbitrary string, finds all files in a >> directory, and returns a long string with those files separated by the >> arbitrary strin

Re: Bash usage: was implicit linkage

2014-10-12 Thread Steve Litt
On Sun, 12 Oct 2014 17:07:01 +0300 Andrei POPESCU wrote: > On Sb, 11 oct 14, 21:40:49, Steve Litt wrote: > > > > From my viewpoint, shellscripts were never intended to be big, huge > > programs. To me, they just glue together commands, and have a few > > rudimentary branching and looping constru

Re: Bash usage: was implicit linkage

2014-10-12 Thread Miles Fidelman
Andrei POPESCU wrote: On Sb, 11 oct 14, 21:40:49, Steve Litt wrote: From my viewpoint, shellscripts were never intended to be big, huge programs. To me, they just glue together commands, and have a few rudimentary branching and looping constructs. Isn't that like buying IKEA furniture, but whe

Re: Bash usage: was implicit linkage

2014-10-12 Thread Don Armstrong
On Sun, 12 Oct 2014, Steve Litt wrote: > This essay practically screams out for somebody to write a C program > that takes an argument of an arbitrary string, finds all files in a > directory, and returns a long string with those files separated by the > arbitrary string. You seem to be looking fo

Re: Bash usage: was implicit linkage

2014-10-12 Thread The Wanderer
On 10/12/2014 at 01:42 PM, Steve Litt wrote: > On Sun, 12 Oct 2014 09:33:43 +0100 Martin Read > wrote: > >> On 12/10/14 04:12, Peter Zoeller wrote: >> >>> But the nice thing is shell scripting is simplistic easy to learn >>> and understand. >> >> I refer the audience to David A. Wheeler's essa

Re: Bash usage: was implicit linkage

2014-10-12 Thread Steve Litt
On Sun, 12 Oct 2014 09:33:43 +0100 Martin Read wrote: > On 12/10/14 04:12, Peter Zoeller wrote: > > But the nice > > thing is shell scripting is simplistic easy to learn and understand. > > I refer the audience to David A. Wheeler's essay[1] on how to handle > filenames correctly in shell scrip

Re: Bash usage: was implicit linkage

2014-10-12 Thread Andrei POPESCU
On Du, 12 oct 14, 10:30:52, The Wanderer wrote: > On 10/12/2014 at 10:07 AM, Andrei POPESCU wrote: > > > Any program that requires additional scripting just to get it running > > is insufficiently advanced. > > > > (you can quote me on that) > > Part of the tradeoff for power is responsibility -

Re: Bash usage: was implicit linkage

2014-10-12 Thread The Wanderer
On 10/12/2014 at 10:07 AM, Andrei POPESCU wrote: > On Sb, 11 oct 14, 21:40:49, Steve Litt wrote: > >> From my viewpoint, shellscripts were never intended to be big, >> huge programs. To me, they just glue together commands, and have a >> few rudimentary branching and looping constructs. > > Isn'

Re: Bash usage: was implicit linkage

2014-10-12 Thread Andrei POPESCU
On Sb, 11 oct 14, 21:40:49, Steve Litt wrote: > > From my viewpoint, shellscripts were never intended to be big, huge > programs. To me, they just glue together commands, and have a few > rudimentary branching and looping constructs. Isn't that like buying IKEA furniture, but when you get home yo

Re: Bash usage: was implicit linkage

2014-10-12 Thread Martin Read
On 12/10/14 04:12, Peter Zoeller wrote: But the nice thing is shell scripting is simplistic easy to learn and understand. I refer the audience to David A. Wheeler's essay[1] on how to handle filenames correctly in shell scripts, and to the bug report that he filed against POSIX.1-2008[2] on t

Re: Bash usage: was implicit linkage

2014-10-11 Thread Peter Zoeller
Hi Steve: I agree that shell scripts are simplistic and not meant for fancy programs although it could be done, just not productive. But the nice thing is shell scripting is simplistic easy to learn and understand. Sure beats the days when I wrote code in Assembler, Cobol, Fortran, PL1, RPG,

Re: Bash usage: was implicit linkage

2014-10-11 Thread Chris Bannister
On Sat, Oct 11, 2014 at 09:40:49PM -0400, Steve Litt wrote: > > Now that I've said that, you can accomplish some pretty incredible > things by gluing a few commands together. I wrote the better half of a > http log evaluation program using a shellscript gluing together grep, > cut, and awk, and pi

Bash usage: was implicit linkage

2014-10-11 Thread Steve Litt
On Sat, 11 Oct 2014 19:05:19 -0400 Doug wrote: > On 10/11/2014 05:28 PM, Steve Litt wrote: > > On Sat, 11 Oct 2014 21:21:14 +0300 > > Daemontools runscripts are incredibly simple shellscripts, that I'm > > sure you could write no sweat except in very wierd edge cases. > > Here's my run script fo