Question

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:

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.

No correct solution

OTHER TIPS

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 :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top