Tim*_*Tim 2 command-line redirect pastebin
每当我要存放一些东西以向某人展示时,我都会跑
command-with-output | pastebinit.
Run Code Online (Sandbox Code Playgroud)
这将返回指向在线粘贴的链接。例如:
echo sometext | pastebinit
Run Code Online (Sandbox Code Playgroud)
给了我链接
我可以分享。如何使用文件执行此操作 - 例如日志文件。我当然不必open - > copy all - > open paste.ubuntu.com -> paste it吗?
cat 是执行此操作的命令:
cat filename | pastebinit
Run Code Online (Sandbox Code Playgroud)
来自man cat:
cat - 连接文件并在标准输出上打印
-A, --show-all
equivalent to -vET
-b, --number-nonblank
number nonempty output lines
-e equivalent to -vE
-E, --show-ends
display $ at end of each line
-n, --number
number all output lines
-s, --squeeze-blank
suppress repeated empty output lines
-t equivalent to -vT
-T, --show-tabs
display TAB characters as ^I
-v, --show-nonprinting
use ^ and M- notation, except for LFD and TAB
With no FILE, or when FILE is -, read standard input.
Run Code Online (Sandbox Code Playgroud)
我个人会使用cat(根据 Rinzwind 的回答),但还有一个-i标志:
pastebinit -i [filename]
Run Code Online (Sandbox Code Playgroud)
来自man pastebinit:
选项
-i [filename] 使用文件名作为输入