Date: Wed, 1 Feb 2017 10:49:30 -0500 From: Roger Pate <roger@qxxy.com> To: Manish Jain <bourne.identity@hotmail.com> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: Variable assignment in sh Message-ID: <CADTH-ouDx6KDEXR=A0K1vWCis_z=UAAdygjYOf9zisB5c0zTqg@mail.gmail.com> In-Reply-To: <VI1PR02MB0974CB37283D680F46DB1907F64D0@VI1PR02MB0974.eurprd02.prod.outlook.com> References: <b831bd9e40321e59910ea8913c7a6302.squirrel@webmail.harte-lyne.ca> <20170131161824.a9f1ef46.freebsd@edvax.de> <b553c644fccc211f9658b31cfe65e8a0.squirrel@webmail.harte-lyne.ca> <20170131185103.7f911dfb.freebsd@edvax.de> <5f51e2c3bdb8a20c6a7786c2b345c957.squirrel@webmail.harte-lyne.ca> <alpine.BSF.2.20.1701311445520.54303@wonkity.com> <20170201014858.eec196d0.freebsd@edvax.de> <VI1PR02MB09748570B8832CAA397D19FFF64D0@VI1PR02MB0974.eurprd02.prod.outlook.com> <CADTH-osmMTbJbC2jsY=LzEEO-K7SDfMusDqnLe2V4%2B-3P2SEmg@mail.gmail.com> <VI1PR02MB0974CB37283D680F46DB1907F64D0@VI1PR02MB0974.eurprd02.prod.outlook.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 1, 2017 at 10:23 AM, Manish Jain <bourne.identity@hotmail.com> wrote: > On 02/01/2017 08:36 PM, Roger Pate wrote: >> Most often, but not always, if I need something bash has and /bin/sh >> lacks, it's time to write that script in a different language. :P > > Generally, FreeBSD community is averse to bash scritpting. But then sh > lacks array support, which is where bash and zsh do wonderfully well. Not just FreeBSD community, but I won't belabor the point. In particular about arrays, remember that sh does support one array well: $@, both global and per-function. If two arrays are needed, but one can be setup in a for loop (useful for globbing files) or list of lines/NUL-terminated-items (pipe into a while loop or process xargs-like), then you are also good to go. > Generally again, I am averse to most Linuxisms, but bash is simply way > too much convenience to ignore. I used to believe so too, but now I am happier writing more complex scripts in Python. Around the same time, I coincidentally switched my interactive shell from bash to zsh (though I don't use zsh for scripting), and also recommend that.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADTH-ouDx6KDEXR=A0K1vWCis_z=UAAdygjYOf9zisB5c0zTqg>