0

I've just installed utop on openSUSE but when i type utop in terminal i have

If 'utop' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf utop

Typing eval 'opam config env' gives me this:

OPAM_SWITCH_PREFIX='/home/jadw1/.opam/default'; export OPAM_SWITCH_PREFIX;
CAML_LD_LIBRARY_PATH='/home/jadw1/.opam/default/lib/stublibs:/usr/lib64/ocaml/stublibs:/usr/lib64/ocaml'; export CAML_LD_LIBRARY_PATH;
OCAML_TOPLEVEL_PATH='/home/jadw1/.opam/default/lib/toplevel'; export OCAML_TOPLEVEL_PATH;
MANPATH='/usr/local/man:/usr/share/man:/home/jadw1/.opam/default/man'; export MANPATH;
PATH='/home/jadw1/.opam/default/bin:/home/jadw1/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/sbin'; export PATH;
Cœur
  • 37,241
  • 25
  • 195
  • 267
Jadw1
  • 139
  • 1
  • 2
  • 3

2 Answers2

1

You're supposed to type this:

$ eval `opam config env`

Not this:

$ opam config env

What happens is that opam config env writes out some shell commands that you want to execute. That's what the eval does. If you see output like you saw, it means you left out the eval.

Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108
  • 2
    But the question mentioned (albeit in a poorly formatted way) `eval 'opam config env'`. You might want to stress the fact that in shell, a backtick `\`` is **very** different from a single quote `'` (or [suggest to use `$()`](https://stackoverflow.com/a/4708569/1633665)) – Virgile Oct 24 '18 at 15:49
  • by the way, did u install utop : "opam install utop" ? – Pierre G. Oct 24 '18 at 16:16
1

eval is a command that constructs commands from the arguments it's given and executes them.

eval 'opam config env', with apostrophes, is therefore equivalent to just running opam config env directly, which just writes out a sequence of shell commands.

If you replace the apostrophes with backticks, however, it will first execute the quoted command, then pass its output to eval and execute that.

eval `opam config env`

is therefore more or less equivalent to running opam config env, then copying and pasting the output back into the console, which you could also do.

glennsl
  • 28,186
  • 12
  • 57
  • 75