HT5639 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

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

Similar Messages

  • How do I stop the login process when I open iTunes?

    How do I stop the login process when I open iTunes? It often request I login sometimes twice.

    I amhaving the same issue of having to log into  my apple account wheever I open I-Tunes. In my iTunes sharing my password requirment is unchecked and in filevault it is unchecked also. I have just upgraded to the newest version of iTunes and I still get the pop-up window asking me to login.
    Any other thoughts?
    thank you

  • How to stop the running process chain

    How to stop the running process chains or infopackges...just qm status change is enought?

    BI - SM 37 - Kill the Job
    ECC - SM 50 - Kill the job

  • How to stop the backup process....

    How to stop the backup process....
    Okay, so it happens nearly everytime you synch your iPhone with your iTunes? Easy. As soon as it starts, hit the "X" in the bar where the backup process is being shown, this does NOT STOP the synching process, ONLY the backup process.
    HOWEVER, keep in mind that a few times during the week (depends how often you synch ur iPhone) it will be good to let the backup process let run fully.
    There we go. Problem solved...

    i agree its what i do i backup whenever i add a new app, or take more pics etc its exactly what i do its what ive been saying on all these threads talking about backups etc, im hoping in 2.0.1 will be bug fixes about this sort of thing...

  • Could somebody please advice how to stop the pages dropping ,when l go on ebay ,utube etc

    could somebody please advice how to stop the pages dropping ,when l go on ebay ,utube etc

    could somebody please advice how to stop the pages dropping ,when l go on ebay ,utube etc

  • How to stop iphone from autoplay when plug into car audio system usb?

    how to stop iphone from autoplaying when connected to your car audio USB ?

    You need to remove the association that Windows has with that particular file type. To do that, you need to open Windows Explorer. From there, click on Tools, then Folder options. Click on the tab that is named file types. You then need to find the extension for the photos that appear in the iPhone, then click that registered file type. Once you do that, there is a section to select the program to open that file type with. You can click on the change button, and that will allow you to change the program that it opens with, or restore the default. There is also a box that can be checked to always use the selected program. If you unselect it, it will prompt you next time on what program to use.
    Hope this helps.

  • How can I insert a number of photos in a numbers doc without the file becoming too large?

    How can I insert a number of photos into a numbers doc without the file becoming too large?

    Use smaller photos.
    Seriously, reduce the file size of the photos in Preview, PhotoShop, iPhoto or other application before inserting tehem into the Numbers document.
    Regards,
    Barry

  • How to stop and start process SAPOSCOL

    Hi, i have a problem with write access for saposcol program. I see that the file saposcol is read the file but its unable to wirte the same.
    Collector           : running
    Start time coll.    : Mon May 21 17:49:49 2007
    Current Time        : Mon Jun 11 13:27:51 2007
    Last write access   : Tue May 29 06:23:46 2007
    Last Read  Access   : Mon Jun 11 13:26:24 2007
    When i try to stop the saposcol i get the following error:
    igzadm> saposcol -k
    Setting Stop Flag :
    13:24:44 11.06.2007   LOG: ==== Stop Flag was set by saposcol (kill_collector()).
    13:24:44 11.06.2007   LOG: ====  The collection process will stop as soon as possible
    can't kill process 409656.
    kill: No such process
    ERROR:No reaction from collecting process 409656.
          Please kill collecting process.exes.
    Am doing this command through SID<ADM> from change directory /run.
    Please help me how to check the permission of the SIDADM to stop the services.
    I also try the same from root user but now use..
    Please guide me how to stop and start the SAPOSCOL in AIX 5.3.
    Advance Thanks.
    Suri Tyson

    Hi, i have the following permission for saposcol
    imserv:/ # ps -ef | grep saposcol | more
        root  118842  528422   0 14:02:17  pts/2  0:00 grep saposcol
    I have changed the ownership as you mentioned....
    imserv:/usr/sap/IGZ/SYS/exe/run # ./saproot.sh igz
    Preparing /usr/sap/IGZ/SYS/exe/run/brbackup ...
    Preparing /usr/sap/IGZ/SYS/exe/run/brarchive ...
    Preparing /usr/sap/IGZ/SYS/exe/run/brconnect ...
    Preparing /usr/sap/IGZ/SYS/exe/run/brtools ...
    Preparing saposcol ...
    Preparing icmbnd ...
    done
    However, i still get the error as:
    igzadm> saposcol -k
    Setting Stop Flag :
    14:12:13 11.06.2007   LOG: ==== Stop Flag was set by saposcol (kill_collector()).
    14:12:13 11.06.2007   LOG: ====  The collection process will stop as soon as possible
    can't kill process 409656.
    kill: No such process
    ERROR:No reaction from collecting process 409656.
          Please kill collecting process.
    Now the permission are set in my system as:
    igzadm> ps -ef |grep saposcol|more
      igzadm  729196  983058   0 14:13:25  pts/2  0:00 grep saposcol

  • How to stop update work process

    hi
    this is mahesh
    in my dev server 3 update workprocess are running very long time .how to stop that 3 update workprocess .i am already deleted the error update record in sm13
    pls tell me how to change this work process running mode to waiting mode.pls give me solution.

    Hi mahesh,
    I guess you want to terminate the workprocesses.
    Go to SM50 select the update process you want to terminate then in menu bar goto <b>Process </b> and then select <b>Cancel without core</b>.it might take some time but the workprocess will get terminated.
    In case it takes too much of a time kill it at OS level.
    Please award points accordingly.
    Regards.
    Ruchit.
    Message was edited by:
            Ruchit Khushu

  • How to stop the boot process after the GRUB menu?

    Hello there.
    I am getting an error message in the boot process, after the GRUB menu, but I can't read completely the message because it is shown too fast. So, how can I stop the process when I see the error message, for writing down it?
    Thanks in advance.

    zuargo wrote:
    Hello there.
    I am getting an error message in the boot process, after the GRUB menu, but I can't read completely the message because it is shown too fast. So, how can I stop the process when I see the error message, for writing down it?
    Thanks in advance.
    I didn't try this before, but if you use systemd, you may want to try systemd.confirm_spawn to invoke interactive booting process, so you can start the services one by one manually therefore locate the one throwing out error message.
    It is explained in the systemd manual:
    http://www.freedesktop.org/software/sys … stemd.html

  • TS1702 How to stop an app download when hit accidently

    How do you stop an app download when you accidentally hit the download button on iPad 3?

    I think the question isn't about purchasing but actually downloading. For example if you see that there is an update available and you start to download, lose internet connection, the application will essentially be locked from use until the update finishes.
    I ran into this problem on holiday where I tried to update Camera Awesome but the internet was painfully slow (56k or less speeds). The application started to download but was taking literally hours to complete. In the meantime I couldn't access any of the photos within that application or use it for new pictures.
    In short, any application that is being downloaded, installed, etc will be unavailable until that process completes.

  • How to stop the Flex application when user clicks on Cancel button from JS-confirm message?

    Hi All,
    I use the next code when a user clicks on a link:
    private function clickHandler():void
          ExternalInterface.call('confirm', 'Of course you want to go to the Adobe forums!');
          navigateToURL(new URLRequest('http://forums.adobe.com'), '_self');
    This will show up the javascript confimation box. But when the cancel-button is clicked, the user goes straightly to http://forums.adobe.com...
    How to stop Flex performing the next code when a user clicks on the Cancel button?
    Or, how to catch which button is clicked by a user in Flex?
    Thanks!

    I agree with Mr. Hall that using mx.controls.Alert in Flex may be a better route.
    Show the Alert like this:
    // show an alert with a question and yes and no choices
    Alert.show( "Would you like to go to the Adobe Forums?", "Question",
         Alert.YES | Alert.NO, this, closeHandler, null, Alert.YES );
    Then handle the response in the closeHandler() function:
    protected function closeHandler( closeEvent:CloseEvent ):void
    if( event.detail == Alert.YES )
         navigateToURL( new URLRequest('http://forums.adobe.com'), '_self' );
    else if( event.detail == Alert.NO )
         // they chose no
    The following documentation on Alerts may be helpful:
    http://www.flexafterdark.com/docs/ActionScript-Alert
    Let me know if that helps...
    Ben Edwards

  • How to stop the upload process?

    Hi,
    i had by mistake started the other upload than the required!
    How to stop the current upload process,( generally it takes lot of time to upload the data as data is huge )
    Thanks,
    Ravi

    Hi Ravi Kottur 
    Just follow the things like Sunil suggested check one more just kill the process
    manually and goto RSMO and in the Monitor QM status just Amke it red manually
    for the load which you want to stop and then go to that particular info provider
    Manage and delte the request.. 
    Hope itz clear a little atleast...!
    Thanks & Regards
    R M K
    ***Assigning pointz is the only way of saying thanx in SDN ***
    **Learning the thingz is never end process if u stop it will Be a devil if u continue it will be a divine***
    > Hi,
    >
    > i had by mistake started the other upload than the
    > required!
    >
    > How to stop the current upload process,( generally it
    > takes lot of time to upload the data as data is huge
    > )
    >
    >
    > Thanks,
    > Ravi

  • How to stop Aperture starting up when iPhone is plugged in?

    Hi all,
    silly question... but Aperture keeps opening whenever my iPhone is plugged in. Does anyone know how to stop this? Not a big deal... but its getting annoying!
    Thanks in advance!
    Lil

    And, if you want Aperture to launch when you connect your camera, but not when you connect your iPhone, open Image Capture when your iPhone is connected, highlight your iPhone in the sidebar, and select the No Application option in the lower left-hand corner where it says "connecting this iPhone opens"
    You can have different options for each device.

  • How to stop a triggered process chain

    Hi,
    Does anyone know how to stop a process chain? It was accidentally triggered twice and we need to stop it. Thanks.

    Hi,
    There r 2 ways to kill the job.
    One is using transation RSMO locate the job and display the status tab double click on the yellow light that is shown on the line total, a pop will come 'set overall status ' is displayed select the desired status that is red and save it. Then return to the monitor page and select the header tab double ckick on the data target right click and then goto 'manage',there should be request sitting there probably with yellow lights , highlight the line with the faulty request click the  delete button then click refresh button.
    Second is goto SM37 and click on the active selection and enter the jobname and then click excute the particulr job should appear highlight the jobname then click on the stop iconthat appears on the taskbar( 3 rd from left)
    hope it is clear.
    Regards-
    Siddhu

Maybe you are looking for