I know this would be really easy for you but I am new in scripting. I would like to know how to put a specific path (a directory) where my script output (which is in .txt file) could go. I have this code which would create a .txt file ready to be placed in /home/ubuntu/scriptoutput directoy:
我知道这对你来说真的很容易,但我是脚本新手。我想知道如何放置我的脚本输出(在.txt文件中)可以去的特定路径(目录)。我有这个代码,可以创建一个.txt文件,准备放在/ home / ubuntu / scriptoutput directoy中:
COUNTER=1
while true; do
FILENAME="HELLO($COUNTER).txt"
if [ -e $FILENAME ]; then
COUNTER=$((COUNTER+1))
else
break
fi
done
(
printf "hello"
) > $FILENAME
Now the question is: Where do I puth the /home/ubuntu/scriptoutput? I hope you could help me.
现在的问题是:我在哪里puth / home / ubuntu / scriptoutput?我希望你能帮助我。
1 个解决方案
#1
1
For the beginners who will also encounter this kind of problem:
对于也会遇到这类问题的初学者:
COUNTER=1
while true; do
FILENAME="/home/ubuntu/scriptoutput/HELLO($COUNTER).txt"
if [ -e $FILENAME ]; then
COUNTER=$((COUNTER+1))
else
break
fi
done
(
printf "hello"
) > $FILENAME
for those who answered, thank you so much :-)
对于那些回答的人,非常感谢你:-)
#1
1
For the beginners who will also encounter this kind of problem:
对于也会遇到这类问题的初学者:
COUNTER=1
while true; do
FILENAME="/home/ubuntu/scriptoutput/HELLO($COUNTER).txt"
if [ -e $FILENAME ]; then
COUNTER=$((COUNTER+1))
else
break
fi
done
(
printf "hello"
) > $FILENAME
for those who answered, thank you so much :-)
对于那些回答的人,非常感谢你:-)