Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2017 17:25:46 -0500
From:      "James B. Byrne" <byrnejb@harte-lyne.ca>
To:        "Garance A Drosehn" <drosih@rpi.edu>
Cc:        "Polytropon" <freebsd@edvax.de>, freebsd-questions@freebsd.org
Subject:   Re: Variable assignment in sh
Message-ID:  <7df89058c8e1c2078611909cdb150e4c.squirrel@webmail.harte-lyne.ca>
In-Reply-To: <mailman.108.1486036867.50898.freebsd-questions@freebsd.org>
References:  <mailman.108.1486036867.50898.freebsd-questions@freebsd.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

On Wed, February 1, 2017 19:21, Garance A Drosehn wrote:

>
> On something of minor tangent, if you're writing scripts in either
> 'sh'
> or 'bash', you may find the following web site helpful:
>


I just wish to clarify something here.  What I am doing is attempting
to reuse a one-liner that has one conditional in it.  I do not
consider that to be scripting or programming.  I am just piping a few
tools together and checking if anything comes out the end.

I have written bash scripts of course, but those things tend to look
like this:

#!/usr/bin/env bash

SCRIPT_NAME=$(basename $0)
VERSION=1.01.001
AUTHOR="<James B. Byrne>byrnejb@harte-lyne.ca"
DATE_CREATED="2011-Jun-03"
DATE_UPDATED="2011-Jun-03"

# Maximum number of arguments allowed by this program
MAXARGS=99

# Minimum number of arguments required by this program
MINARGS=0

SCRIPT_PATH=$(dirname $0)
usage()

{
cat >&2 << EOD

Version: $VERSION
Usage: $SCRIPT_NAME [options] [arguments]

# Purpose of script:
#    This is a script template with examples of getopts usage
#

This script supports the following options:
OPTIONS:
  -h        Show this message and exit with failure status 2
  -a=value  set option a to value
  -b=value  set option b to value
  -d=level  set debug level to level
. . .


Today when I script then I tend to use Ruby.  Tomorrow? Who knows?

-- 
***          e-Mail is NOT a SECURE channel          ***
        Do NOT transmit sensitive data via e-Mail
 Do NOT open attachments nor follow links sent by e-Mail

James B. Byrne                mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?7df89058c8e1c2078611909cdb150e4c.squirrel>