我有三个文件x,y和z以及一些内容.
如果我运行$cat x y z > z它似乎在将x和y写入z之前截断文件z.
我期望它只是将x,y和z的内容连接成z.有人可以解释为什么不是这样吗?还请解释我收到的这个警告
$ echo "one" > x
$ echo "two" > y
$ echo "three" > z
$ cat x y z
one
two
three
$ cat x y z > z
cat: z: input file is output file
$ cat z
one
two
Run Code Online (Sandbox Code Playgroud)