iCloud
Q: How to stop a Terminal process when a file becomes to large?
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 //// run it with out the comment to see how
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:26 AM
by BobTheFisherman,Solvedanswer
There is no need to post the same question more than once.
https://discussions.apple.com/thread/5209171?tstart=0
You could try posting in the developer forum https://discussions.apple.com/community/developer_forums
Posted on Aug 1, 2013 9:30 AM