4

When in freebsd you install any software using

cd /usr/ports/mysql56-server
make install

It produces a lot of output on the screen.

How you can read that output latter in a file.

I tried

cd /usr/ports/mysql56-server
make install > /home/mysql.install.log

BUT IT FAILED -( ........... Any Suggestion??

9

Try this:

cd /usr/ports/mysql56-server
make install > /home/mysql.install.log 2>&1

Probably, some ouputs is printed to stdout, some to stderr. So you can save all outputs by redirect stderr to stdout, then write stdout to a file.

You can also use tee command:

make install 2>&1 | tee /home/mysql.install.log

n.b. The stderr redirection is still necessary for pipes.

@Nishan

If you use csh, try this:

make install >& /home/mysql.install.log
  • I'm sorry to say both give Ambiguous Output Redirect. – Nishan Mar 10 '14 at 6:38
  • Ah, maybe you use csh? – cuonglm Mar 10 '14 at 6:48
  • Great Working UPDATED SOLUTION +1 – Nishan Mar 10 '14 at 7:04
3

Have a look at man script. ;) Basically, you do script somefile.txt, and it will open a new shell where everything that happens gets written to somefile.txt (exit to quit).

2

The output you are referring to is being printed to standard error, not standard output. To capture stderr, you need 2>:

make install 2> /home/mysql.install.log
  • It only record error messages. – PersianGulf Mar 9 '14 at 17:32
  • 1
    @MohsenPahlevanzadeh thank you, I know. That's what I'm saying in my answer (and that's why I upvoted Gnouc's answer and will upvote yours now that Gnouc corrected it). In any case, the OP already redirected stdout and claimed it failed so presumably, they wanted stderr. Either way, please don't downvote answers unless they are actually wrong. – terdon Mar 9 '14 at 17:39
  • Wow, Realy sorry, i didn't read its post completly. – PersianGulf Mar 9 '14 at 17:41
  • This did what what requested but with error but it converted my /home directory into file. WHERE HAS GONE MY _/home_ DIRECTORY -(` – Nishan Mar 10 '14 at 6:51
  • @Nishan huh? Did you maybe leave a space between /home/ and mysql.install.log? – terdon Mar 10 '14 at 15:17
0
make install > /home/mysql.install.log 2>&1

0 == stdin

1 == stdout

2 == stderr

default == 1

  • 1
    0 is stdin, 1 is stdout. – cuonglm Mar 9 '14 at 17:33
  • I'm sorry that give Ambiguous Output Redirect. – Nishan Mar 10 '14 at 6:58
  • What's your shell? – PersianGulf Mar 10 '14 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.