Quote:
You want to run an interactive script, gabby, which produces a lot of output in response to the user's inputs. To facilitate future study of this script, you want to copy its output to a file. How might you do this?
gabby > gabby-out.txt
gabby | tee gabby-out.txt
gabby < gabby-out.txt
gabby &> gabby-out.txt
|
I don't have an interactive script that I know of, so i decided to use gpg --gen-key because it's interactive. The last command captured the stderr, but not the stdout.
Code:
203/3954MB 0.98 1.07 1.05 3/492 19386
[19065:2023 0:301] 11:15:15 Fri Jun 08 [bull@beastlinux: +2] ~
(2:301)$ gpg --gen-key > /tmp/gabby-out.txt
gpg (GnuPG) 1.4.12; Copyright (C) 2012 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
gpg: Interrupt caught ... exiting
202/3954MB 1.05 1.08 1.05 1/492 19392
[19065:2023 0:302] 11:15:23 Fri Jun 08 [bull@beastlinux: +2] ~
(2:302)$ cat /tmp/gabby-out.txt
202/3954MB 1.05 1.08 1.05 1/492 19398
[19065:2023 0:303] 11:15:26 Fri Jun 08 [bull@beastlinux: +2] ~
(2:303)$ gpg --gen-key | tee /tmp/gabby-out.txt
gpg (GnuPG) 1.4.12; Copyright (C) 2012 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
gpg: Interrupt caught ... exiting
200/3954MB 1.11 1.10 1.05 1/492 19407
[19065:2023 0:304] 11:15:36 Fri Jun 08 [bull@beastlinux: +2] ~
(2:304)$ cat /tmp/gabby-out.txt
182/3954MB 1.24 1.13 1.06 1/492 19414
[19065:2023 0:305] 11:15:50 Fri Jun 08 [bull@beastlinux: +2] ~
(2:305)$ gpg --gen-key &> /tmp/gabby-out.txt
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
176/3954MB 1.41 1.17 1.08 1/490 19420
[19065:2023 0:306] 11:16:01 Fri Jun 08 [bull@beastlinux: +2] ~
(2:306)$ cat /tmp/gabby-out.txt
gpg (GnuPG) 1.4.12; Copyright (C) 2012 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: Interrupt caught ... exiting
176/3954MB 1.29 1.15 1.07 1/490 19426
[19065:2023 0:307] 11:16:06 Fri Jun 08 [bull@beastlinux: +2] ~
(2:307)$