I was making a terminal program to produce a txt file with incrementing numbers every line. But do to time and size I had wished the program to stop when it produced a txt file larger than 1GB here is the code I was using.

#!/bin/bash

main()

{

cd ~/desktop

a=0

b=1

a=`expr $a + 1`

echo $a

echo $a >> count.txt

run

}

count()

{

b= du -skL count.txt > /dev/null ///// problem here

a=`expr $a + 1`

clear

echo "#"$a "-" $b"KB"

echo $a >> count.txt

}

run()

{

cd ~/desktop

while [ $b -lt 1048576 ]

do

count

done

}

main

MacBook, OS X Mountain Lion (10.8.4)

Posted on Aug 1, 2013 9:19 AM

Reply
1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

I was making a terminal program to produce a txt file with incrementing numbers every line. But do to time and size I had wished the program to stop when it produced a txt file larger than 1GB here is the code I was using.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.