tokuhirom / plenv

Perl binary manager
Other
516 stars 71 forks source link

Thank you - seems to work in ksh93 #176

Open kajukenbo opened 3 years ago

kajukenbo commented 3 years ago

This is just a quick thank you.

I needed an old Perl 5.8.x - 5.10.x version for testing. "perlbrew" has all sorts of bashisms and complexities in their scripts that defy straightforward porting to non-Bash hosts.

While your site says plenv is for "Bash", there is nothing complex about the scripts and I installed via ksh93 in minutes.

Please keep up the great work. I will try to get my head around plenv tomorrow and do some tests.

Much appreciated.

kajukenbo commented 3 years ago

FWIW, I think the only issue with $ ~/.plenv/bin/plenv is that non-POSIX "here-strings" and other unnecessary Bash-isms (from 4.x +?) are used.

Here is an overview of the changes I made to make it a a bit more portable:

Oddly complicated?

#read READLINK < <( type -p greadlink readlink ) || {
  #echo "plenv: cannot find readlink - are you missing GNU coreutils?" >&2
  #exit 1
#}

Becomes:

READLINK=`type -p readlink`
export READLINK

This seems like the hard way here, perhaps I am missing something:

#export -n CDPATH
unset CDPATH

Use typeset (ksh) instead of local (Bash-ism):

:%s/local /typeset /gc

Really lazy hack

:%s/^shopt/# /

I also changed the shebang to ksh93 as a proof-of-concept:

#!/usr/bin/env ksh

Maybe when I have some time I will look into trying to make it POSIX-compliant.