Re: Bash 4 vs Bash 5

2021-09-19 Thread Andrew Pam via luv-main

On 19/9/21 3:25 pm, Alexar Pendashteh via luv-main wrote:

2. Is it important or worth making the script compatible with bash v4?


Is there a reason you need the features of bash v5?  I prefer to make my 
bash scripts as portable as possible.  I recommend installing the 
"shellcheck" package and running shellcheck on your script to get some 
recommendations on how to make your script safer and more portable.


Hope that helps,
Andrew
--
mailto:and...@sericyb.com.au  Andrew Pam
https://sericyb.com.au/   Manager, Serious Cybernetics
https://glasswings.com.au/Partner, Glass Wings
___
luv-main mailing list -- luv-main@luv.asn.au
To unsubscribe send an email to luv-main-le...@luv.asn.au


Re: Bash 4 vs Bash 5

2021-09-19 Thread Morrie Wyatt via luv-main

Hi Alexar.

On 19/09/2021 3:25 pm, Alexar Pendashteh via luv-main wrote:
I have been using a bash script happily for quite a while. Today, for 
the first time I faced an error.


I noticed the server is running *GNU bash, version 4.2.46(2)-release*
Whereas I have always been on version 5.

I don't have the access to upgrade the version. So, the questions are:

1. Is there a way to manually use bash v5 without root access?

2. Is it important or worth making the script compatible with bash v4?


I'm afraid that question falls under the category of "How long is a 
piece of string?"


If your scripts rely heavily on capabilities only present in v5 then 
refactoring your

scripts to work with v4 will entail a matching degree of work.

Bash v5 however is very likely to have library dependencies that the 
server's version
of linux doesn't meet. That can be an even deeper rabbit hole of nested 
dependencies.


So if you need to employ that particular server, then porting to bash v4 
is your only

sensible alternative.

It's one of the reasons that sh is commonly used rather than bash, to 
prevent specific

"bashisms" from impacting script portability. Lowest common denominator.

Regards,
Morrie.

___
luv-main mailing list -- luv-main@luv.asn.au
To unsubscribe send an email to luv-main-le...@luv.asn.au


Re: Bash 4 vs Bash 5

2021-09-19 Thread Russell Coker via luv-main
On Sunday, 19 September 2021 15:25:48 AEST Alexar Pendashteh via luv-main 
wrote:
> I noticed the server is running *GNU bash, version 4.2.46(2)-release*
> Whereas I have always been on version 5.
> 
> I don't have the access to upgrade the version. So, the questions are:
> 
> 1. Is there a way to manually use bash v5 without root access?

Download the source and compile it.  Bash doesn't seem to have as many 
dependencies as I remember it having so maybe bash 5 inlined some of the code 
for things it needed.

> 2. Is it important or worth making the script compatible with bash v4?

How big is your script?  If it's a small script then changing the script will 
be easier, if it's a big/complex script that's run on other systems as well 
then maybe compiling bash will be easier.

Check whether there is still security support for the distribution in question 
and make a case for upgrading the entire server.  CentOS 7 (which includes 
that version of bash) ended "full support" on 2020-08-06, is that combined 
with CentOS going away (if it's CentOS) a reason to upgrade the server?

-- 
My Main Blog http://etbe.coker.com.au/
My Documents Bloghttp://doc.coker.com.au/

___
luv-main mailing list -- luv-main@luv.asn.au
To unsubscribe send an email to luv-main-le...@luv.asn.au


Bash 4 vs Bash 5

2021-09-18 Thread Alexar Pendashteh via luv-main
I have been using a bash script happily for quite a while. Today, for the
first time I faced an error.

I noticed the server is running *GNU bash, version 4.2.46(2)-release*
Whereas I have always been on version 5.

I don't have the access to upgrade the version. So, the questions are:

1. Is there a way to manually use bash v5 without root access?

2. Is it important or worth making the script compatible with bash v4?

+ Alexar
___
luv-main mailing list -- luv-main@luv.asn.au
To unsubscribe send an email to luv-main-le...@luv.asn.au