I futureproofed it a little :-)-O

#!/bin/bash
function lyxconfigure
{
        if [[ "$OSTYPE" == "darwin"* ]]
        then
                BASEDIR="/Users/$(whoami)/Library/Application Support/LyX"
                LYXVER=$(lyx --version 2>&1 \
                        | perl -ne 'if (/^LyX/) {
                                @v = split(/\s+/);
                                ($j,$i) = split(/\./,$v[1],3);
                                print "$j.$i"
                        }'
                )
                pushd "$BASEDIR-$LYXVER"
                python -tt 
"/Applications/LyX.app/Contents/Resources/configure.py"
                popd
        else
                echo "This only works on a Mac"
        fi
}

If someone can come up with a clever way of finding the maJor and miNor 
versions of LyX, please let me know.

Heartbleed was an OpenSSL vulnerability by the way, and, though Bashdoor
was an issue in 2014, I use bash as my login shell so I don't really
think it matters much.  But as Steve wrote it's trivial to change.


On 06/02/2019 10:49, Dr Eberhard Lisse wrote:
[...]
> On 06/02/2019 09:53, Steve Litt wrote:
[...]
>> Beware that pushd and popd are bash-only, and do not appear in dash or
>> any /bin/sh one should be using for shellscripts. I'm of the opinion,
>> especially after the Heartbleed fiasco, that bash is just too big an
>> attack surface to use for shellscripts.
>>
>> In more lightweight shells, it's done more like this:
>>
>> #!/bin/sh
>> orgdir=`pwd`
>> cd /home/you/application/directory
>> ./my_special_application arg1 arg2 arg3
>> cd $orgdir
[...]


Reply via email to