Skip to content

Instantly share code, notes, and snippets.

@Taeril
Created March 19, 2013 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Taeril/5194434 to your computer and use it in GitHub Desktop.
Save Taeril/5194434 to your computer and use it in GitHub Desktop.
Play with eval to see where perlbrew broke
#!/bin/sh
export PATH=".:$PATH"
foobar_command='command foobar.sh'
#foobar_command='foobar.sh'
FOOBAR_FOO='foo-1.23.4'
# old
#eval "$(${foobar_command} env $FOOBAR_FOO)"
# new
#$(eval $foobar_command env $FOOBAR_FOO)
#set -x
#eval "$(eval "${foobar_command} env $FOOBAR_FOO")"
eval "$(eval ${foobar_command} env $FOOBAR_FOO)"
#set +x
env | grep 'FOOBAR'
#!/bin/sh
echo 'export FOOBAR_MANPATH="/home/user/perl5/perlbrew/perls/perl-5.16.3/man";'
echo 'export FOOBAR_PATH="/home/user/perl5/perlbrew/bin:/home/user/perl5/perlbrew/perls/perl-5.16.3/bin";'
echo "export FOOBAR_PERL=\"$2\";"
echo 'export FOOBAR_ROOT="/home/user/perl5/perlbrew";'
echo 'export FOOBAR_VERSION="0.60";'
#!/bin/sh
test_it() {
echo "--- $1"
$1 ./foo.sh
echo '---'
}
# GNU bash, version 4.2.37(1)-release (i486-pc-linux-gnu)
test_it '/bin/bash'
# zsh 4.3.17 (i686-pc-linux-gnu)
test_it '/usr/bin/zsh'
# from git
test_it '/tmp/foo/bin/zsh-5.0.2-dev-0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment