关于linux的输入重定向,举个例子行吗?

2025-03-12 10:05:04
推荐回答(2个)
回答1:

$ 1>filename

$ 是命令提示符 , 你光输入这肯定是空的

你输入 1 回车也 不是空的吗..

ls > filename

就是把 ls 命令的输入冲定向到 文件 filename 里面.

回答2:

输出重定向
echo "abc" > file1
cat file1
输入重定向
#!/bin/sh
while read line
do
echo $line
done < file1