quick question, how do I write a shell script that prompts users to enter let say 5 lines and it will stores those lines into a .t开发者_开发知识库xt file for example,
Today is hot
Today is code
Today is chilly
Today is windy
Today is sunny
not like
Today is hot Today is code Today is chilly Today is windy today is sunny
Thanks for your help
In bash you can do:
for i in {1..5}
do
read line
echo $line >> file.txt
done
Does this count?
sed 5q > file.txt
精彩评论