0

I have this line of code :

[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

Is there a difference between

  • eval "$(SHELL=/bin/sh lesspipe)"

and more simply

  • SHELL=/bin/sh lesspipe (or export SHELL=/bin/sh lesspipe)

(What is the difference between using export and not using it by the way?)

1
  • It's worth pointing out that SHELL=/bin/sh lesspipe isn't SHELL being set to /bin/sh lesspipe; it's running lesspipe with the environment variable SHELL set to /bin/sh for that command only. If that wasn't clear. Commented May 8, 2013 at 3:59

1 Answer 1

1

Yes, there's a difference.

The second example just runs lesspipe with the SHELL variable set to /bin/sh in its environment.

The first example does the same, but takes the output and runs that as a command in your current shell.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.