[GTALUG] Script to show HTTP(S) and TLS details for a website

Chris F.A. Johnson chris at cfajohnson.com
Sun Aug 11 20:11:26 EDT 2019


On Sun, 11 Aug 2019, Giles Orr via talk wrote:

> On Sat, 10 Aug 2019 at 11:46, Giles Orr <gilesorr at gmail.com> wrote:
>       ...https://www.gilesorr.com/blog/tls-https-details.html
> 
> Any suggestions to improve the script would be most welcome.
> 
> 
> Jason:
>

> You are of course correct: '#!/usr/bin/env bash' is more portable.?
> I don't usually bother because '#!/usr/bin/bash' works fine on every
> Linux I've used and on Mac, so I don't think to fix this when I make
> my scripts public ...

$ ls /usr/bin/bash
ls: cannot access '/usr/bin/bash': No such file or directory

It is usually /bin/bash

> 
> Dave:
> "Line 130 s/-eq/=/"

>  See, that's interesting ...? First, "==" would be correct for a
> Bash string comparison, not "=" (which is correct for 'sh').? Second
> ...? Arguably it's a numeric comparison (thus '-eq'), but I did put
> quotes around it which probably makes it string ...? <sigh>? Yeah, I
> don't know what that should be.? It's worked so far ...

You said that is could return 1.1; that is not a valid number in bash.

Also, you are combining two syntaxes in your function definitions. You
can use either

function funcname { : ## ksh style
}

or

funcname() { :   ## POSIX style
}

You don't need both.


-- 
    Chris F.A. Johnson                         <http://cfajohnson.com/>
    =========================== Author: ===============================
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
    Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress)


More information about the talk mailing list