Help on DB2 Command

Hi Folks,
I want to know the list of all tables in my DB2 database, based on the parameter  "Large RIDs"  which I can see in the transaction DBACOCKPIT.
If I have to see it manually, I have a mammoth task of doing it once for every table.
Are there any commmands to achieve this in a single go ??
Please help.
Thanks,
Raj

Hi,
this can be done by querying TABNAME, LARGE_RIDS (and LARGE_SLOTS) columns in the sysibmadm.admintabinfo view.
Regards HJ

Similar Messages

  • Running a db2 command from Java Application ??

    Hi All,
    I have to write an application in JDBC that can retrieve a list of databases on a db2 server, the only way I know is the db2 command "list database directory", but I can not use it in a JAVA program, is there a solution for this?
    Can anyone help me in this regard ?
    Thanks in Advance.

    If your driver implement it you can list databases with DatabaseMetaData
    Connection conn = ...
    DatabaseMetaData meta = conn.getMetaData();
    ResultSet rs = meta.getCatalogs();
    while (rs.next())
        System.out.println(rs.getString("TABLE_CAT"));
    }

  • How to check fastest growing tables in db2 via db2 command

    Hi Experts,
    You might feel this very silly question on this forum, but still because of some requirement’s I need that. I'm new to db2 and basis so please bare my immatureness.
    Our DB size is growing faster @ 400/500 MB per day from last 15 days, which is supposed to be not more than 100 MB per day. We want to check the fastest growing tables. So i checked the history in db02 transaction and select the entry field as per 'Growth'. But for the given specific date it is showing nothing. Earlier we had same issue some 3 months back that time it used to display with same selection criteria.
    So I want a db2 command to execute and check the fastest growing table on database level. Please help guys. Early reply must be appreciated.
    PFA screenshot. DB version is DB2 9.7 and OS is Linux
    Thanks & Regards,
    Prasad Deshpande

    Hi Gaurav/Sriram,
    Thanks for the reply..
    DBACOCKPIT is best to go i agree with you but on DBACOCKPIT though our data collector framework and rest all the things are configured properly but still it is not working. It is not changed from last 1 year, and for same scenario 3 months ago it has displayed the growth tables.
    Any how i have raised this issue to SAP so let the SAP come back with the solution on this product error.
    In the mean while @ Experts please reply if you know the DB level command for getting the fastest growing table.
    I'll update the SAP's reply for the same as soon as i get, so that the community should also get the solution for this..
    Thanks & Regards,
    Prasad Deshpande

  • Can anyone help with Double Command issues. This a specific keyboard question and they do not seem to know.

    Before I go into a lengthy explanation of the problem: Can anyone help with Double Command issues. This a specific keyboard question and they do not seem to know.
    Thanks much.
    Emile

    Choose Force Quit from the Apple menu and close Mail from there.
    (103661)

  • How to run db2 command by using Runtime exec

    Hello
    I am using java. When i am runing db2 command by using Runtime.exec( String cmd, String[] env ). I gave the environment path
    DB2CLP=6259901
    DB2DRIVER=D:\ibm\db2\java\db2java.zip
    DB2HOME=D:\ibm\db2
    DB2INSTANCE=DB2
    DB2MMTOP=D:\CMBISS
    but still I am getting error message
    "DB21061E Command line environment not initialized"
    after setting the above path in the cmd It is working fine. When i am trying thro java programm i am getting the above error. Can I get answer for this.
    bhaski.

    Before you can execute DB2 commands you have to open a DB2 CLP. The following code will do so:
    import java.io.IOException;
    public class Db2 {
         public static void main(String args[]) {
              try {
                   Runtime rt = Runtime.getRuntime();
                   Process child = rt.exec("db2cmd");
                   child.waitFor();
              catch (IOException io) {
                   io.printStackTrace();
              catch (InterruptedException e) {
                   e.printStackTrace();

  • Db2 command for create tablespaces of DB2 V9.1.3

    Dear All,
    Currently, I’ve run prepare for upgrade SAP form 4.6C/DB2 9.1.3 to ECC6.
    But, I don’t know to db2 command for create tablespaces as below.
    Could you please example the DB2 command for create tablespaces as below.
    ERROR> Insufficient free space in the database as follows:
    Please refer to file DBFPLUSD.RES for more details and dditional  information about the results of the free space check on DB6 !!!
    ERROR> Create tablespace PSAPDIMD with 120 MB
    ERROR> Create tablespace PSAPDIMI with 120 MB
    ERROR> Create tablespace PSAPODSD with 130 MB
    ERROR> Create tablespace PSAPODSI with 130 MB
    ERROR> Create tablespace PSAPFACTD with 120 MB
    ERROR> Create tablespace PSAPFACTI with 120 MB
    ERROR> Create tablespace PSAPEL700D with 420 MB
    ERROR> Create tablespace PSAPEL700I with 220 MB
    ERROR> Create tablespace PSAPES700D with 21290 MB
    ERROR> Create tablespace PSAPES700I with 5420 MB
    Thanks in advance
    Regards,
    Jaturong P.

    Hi,
    During the PREPARE phase normally it creates a script which you can run for the creation of these Tablespaces,this script can be found in the Upgrade directory(eg:/usr/sap/put/log/DB6TBSXT.CLP - this script will have the command to create the tablespaces).Just run this script,it will create all the tablespaces based on the requirement.
    Regards,
    Sam
    Edited by: Cheriyan Sam on Apr 22, 2008 9:12 AM

  • Passing DB2 commands via cfquery

    Hi-
    Does anyone know how to pass DB2 command(s) via a cfquery?
    I've been tasked with getting a SQL query into Coldfusion
    that uses - what looks to me - like a native DB2 command. (The DB2
    EXPORT command takes data specified from a query and writes a
    formatted file.) Specifically, I need to pass a query via
    <cfquery> that looks something like:
    <cfquery...>
    EXPORT TO file.out
    OF DEL MODIFIED BY STRIPLZEROS
    SELECT
    select statement here
    </cfquery>
    I'm kinda thinking that if you know how to "escape" the
    native commands in a cfquery that might work, but for now when I
    pass the above query it errors out on me.
    Anyone?
    Thanks,
    Rich

    rich.leach wrote:
    > Hi-
    >
    > Does anyone know how to pass DB2 command(s) via a
    cfquery?
    >
    > I've been tasked with getting a SQL query into
    Coldfusion that uses - what
    > looks to me - like a native DB2 command. (The DB2 EXPORT
    command takes data
    > specified from a query and writes a formatted file.)
    Specifically, I need to
    > pass a query via <cfquery> that looks something
    like:
    >
    > <cfquery...>
    > EXPORT TO file.out
    > OF DEL MODIFIED BY STRIPLZEROS
    > SELECT
    > select statement here
    > </cfquery>
    >
    > I'm kinda thinking that if you know how to "escape" the
    native commands in a
    > cfquery that might work, but for now when I pass the
    above query it errors out
    > on me.
    >
    > Anyone?
    >
    > Thanks,
    >
    > Rich
    In general you just pass it in, just like you tried. All the
    <cfquery
    ...> tag is wrap everything inside it up and passes it to
    the database
    as the string it is.
    What you very likely are running into a limitation of the
    database
    driver between ColdFusion and your database. It may not be
    able to
    handle this command and|or the type of result it returns.
    Checking on
    the drivers capabilities and|or alternate choices maybe
    required.
    Alternatively, does DB2 support some type of stored
    procedure? Can you
    write this code in the database and just call it with
    <cfquery ...> or
    <cfstoredprocedure...> tags?

  • Solaris: Syntax errors on all db2 commands run in terminal

    DB2 Express 9.5 x86 installed on Solaris 10 x86.
    Just about every DB2 command I run gets some type of syntax error.
    There has to be some additional configuration required after installing DB2.
    When I run these without the sh in front, I get a "command not found" message.
    Here are edited examples.
    I had to remove some of the disallowed content from the examples and replace with xxxx's.
    Examples:
    bash-3.00# sh db2level
    db2level: xxxxxxxx: not found
    db2level: syntax error at line 19: `(' unexpected
    bash-3.00# sh db2
    db2: syntax error at line 3:
    bash-3.00# sh db2fs
    Usage: dirname path
    db2fs: test: argument expected
    bash-3.00# sh db2admin
    db2admin: syntax error at line 2:
    `"#' unexpected
    bash-3.00# sh db2daslevel
    db2daslevel: syntax error at line 1: `(' unexpected
    bash-3.00# sh db2fmd
    db2fmd: syntax error at line 20: `(' unexpected
    bash-3.00# sh db2diag
    db2diag: syntax error at line 8: `(' unexpected

    Definitely the wrong forum for those questions.

  • Help in DB2 backup problem

    Dear experts,
    your help required.
    i'm new to DB2, i can handel MS_sql.
    recendlty my company is running SAP on DB2 (windows 2003 server)
    i'm unbale to find the init<SID>.db2/db6 to check and adjust the parameters.
    if there is any configuration file (to adjust/configure tape drive) please let me know .
    main 2 problems are :-
    i need to archive the log (now it is 80%) to disk and tape.
    *it is very help full,if you can give the syntax that has to typed in command line.
    how to increase the size of archive log ?
    how important it is to preserve the archived log ?
    *how to put the label for archived log to disc or tape drive ?
    and about tape drive backup:-
    *i'm unable to take backup.
    here is the steps that i had tried, to take backup or initialize the tape in drive.
    H:\IBM\SQLLIB\BIN>db2 backup db to
    .\tape0
    SQL0104N An unexpected token "
    .\tape0" was found following "TO". Expected
    tokens may include: "USER". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>
    H:\IBM\SQLLIB\BIN>db2 backup db to
    .\tape0
    SQL0104N An unexpected token "
    .\tape0" was found following "TO". Expected
    tokens may include: "USER". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>db2 rewind tape
    .\tape0
    SQL0104N An unexpected token "
    .\tape0" was found following "TAPE".
    Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>db2 REWIND TAPE
    .\TAPE0
    SQL0104N An unexpected token "
    .\TAPE0" was found following "TAPE".
    Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>db2 initialize tape
    .\TAPE0
    SQL0104N An unexpected token "
    .\TAPE0" was found following "TAPE".
    Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>LOGARCHMETH1
    'LOGARCHMETH1' is not recognized as an internal or external command,
    operable program or batch file.
    H:\IBM\SQLLIB\BIN>db2tapemgr
    Parameter error. Reason: "DBT2120N No operation is specified.".
    Incorrect syntax. Correct the syntax and reissue the command.
    db2tapemgr [DATABASE database-alias]
    [ON DBPARTITIONNUM db-partition-number]
    {{{{STORE | DOUBLE STORE}[Store-Option-Clause]|
    RETRIEVE [Retrieve-Option-Clause]|
    SHOW TAPE HEADER tape-device}
    [USING blocksize][EJECT]}|
    EJECT TAPE tape-device|
    DELETE TAPE LABEL tape-label|
    QUERY [For-Rollforward-Clause]} [TRACE]
    Store-Option-Clause:
    ON tape-device [TAPE LABEL tape-label]
    [ALL LOGS|n LOGS][FORCE]
    Retrieve-Option-Clause:
    {[For-Rollforward-Clause]
    FROM tape-device[TO directory]|
    {ALL LOGS|LOGS n TO m}
    FROM tape-device[TO directory]|
    HISTORY FILE
    FROM tape-device TO directory }
    For-Rollforward-Clause:
    FOR ROLLFORWARD
    TO {END OF LOGS|isotime [USING LOCAL|GMT TIME]}
    [USING HISTORY FILE history-file]
    DBT2008N db2tapemgr failed with errors.
    H:\IBM\SQLLIB\BIN>
    H:\IBM\SQLLIB\BIN>db2tapemgr db prd store on
    .\tape0
    DBT2065I Using database partition "NODE0000".
    DBT2071I Using the automatic generated tape-label "PRD20070712193141".
    Scanning history.
    DBT2016I No log files found for processing.
    DBT2006I db2tapemgr completed successfully.
    H:\IBM\SQLLIB\BIN>
    i request all experts to help me out in this basic step/configuration.
    it would be very help full to the freshers.
    Thanking you all,
    by
    Raghav

    Dear experts,
    your help required.
    i'm new to DB2, i can handel MS_sql.
    recendlty my company is running SAP on DB2 (windows 2003 server)
    i'm unbale to find the init<SID>.db2/db6 to check and adjust the parameters.
    if there is any configuration file (to adjust/configure tape drive) please let me know .
    main 2 problems are :-
    i need to archive the log (now it is 80%) to disk and tape.
    *it is very help full,if you can give the syntax that has to typed in command line.
    how to increase the size of archive log ?
    how important it is to preserve the archived log ?
    *how to put the label for archived log to disc or tape drive ?
    and about tape drive backup:-
    *i'm unable to take backup.
    here is the steps that i had tried, to take backup or initialize the tape in drive.
    H:\IBM\SQLLIB\BIN>db2 backup db to
    .\tape0
    SQL0104N An unexpected token "
    .\tape0" was found following "TO". Expected
    tokens may include: "USER". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>
    H:\IBM\SQLLIB\BIN>db2 backup db to
    .\tape0
    SQL0104N An unexpected token "
    .\tape0" was found following "TO". Expected
    tokens may include: "USER". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>db2 rewind tape
    .\tape0
    SQL0104N An unexpected token "
    .\tape0" was found following "TAPE".
    Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>db2 REWIND TAPE
    .\TAPE0
    SQL0104N An unexpected token "
    .\TAPE0" was found following "TAPE".
    Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>db2 initialize tape
    .\TAPE0
    SQL0104N An unexpected token "
    .\TAPE0" was found following "TAPE".
    Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601
    H:\IBM\SQLLIB\BIN>LOGARCHMETH1
    'LOGARCHMETH1' is not recognized as an internal or external command,
    operable program or batch file.
    H:\IBM\SQLLIB\BIN>db2tapemgr
    Parameter error. Reason: "DBT2120N No operation is specified.".
    Incorrect syntax. Correct the syntax and reissue the command.
    db2tapemgr [DATABASE database-alias]
    [ON DBPARTITIONNUM db-partition-number]
    {{{{STORE | DOUBLE STORE}[Store-Option-Clause]|
    RETRIEVE [Retrieve-Option-Clause]|
    SHOW TAPE HEADER tape-device}
    [USING blocksize][EJECT]}|
    EJECT TAPE tape-device|
    DELETE TAPE LABEL tape-label|
    QUERY [For-Rollforward-Clause]} [TRACE]
    Store-Option-Clause:
    ON tape-device [TAPE LABEL tape-label]
    [ALL LOGS|n LOGS][FORCE]
    Retrieve-Option-Clause:
    {[For-Rollforward-Clause]
    FROM tape-device[TO directory]|
    {ALL LOGS|LOGS n TO m}
    FROM tape-device[TO directory]|
    HISTORY FILE
    FROM tape-device TO directory }
    For-Rollforward-Clause:
    FOR ROLLFORWARD
    TO {END OF LOGS|isotime [USING LOCAL|GMT TIME]}
    [USING HISTORY FILE history-file]
    DBT2008N db2tapemgr failed with errors.
    H:\IBM\SQLLIB\BIN>
    H:\IBM\SQLLIB\BIN>db2tapemgr db prd store on
    .\tape0
    DBT2065I Using database partition "NODE0000".
    DBT2071I Using the automatic generated tape-label "PRD20070712193141".
    Scanning history.
    DBT2016I No log files found for processing.
    DBT2006I db2tapemgr completed successfully.
    H:\IBM\SQLLIB\BIN>
    i request all experts to help me out in this basic step/configuration.
    it would be very help full to the freshers.
    Thanking you all,
    by
    Raghav

  • Query help in sql commands

    using apex 4.1 i'm entering the following query in the sql command window and I keep getting a pop-up for Entering Bind Variable. I'm not using bind variables though, anyone else see this issue before?
    SELECT A.FIRST,A.LAST,A.COMPANY AS CNAME,
    J.TOT_MAN_HOURS,
    J.ACREAGE,
    W.NUM_WORKERS,
    W.START_DT
    FROM EW_ACCOUNTS A, EW_WORK_ORDER W, EW_JOBS J
    WHERE A.ID = J.ACCT_ID
    AND J.JOB_ID = W.JOB_ID
    AND W.START_DT >= SYSDATE
    AND W.START_DT < SYSDATE+1
    ORDER BY W.START_DT

    I tried that and it didn't seem to help either.
    Funny though, if I write a new query against just one of the tables and write out each column name. it works. If I use the * instead of writing each column name, I have the same issue.
    This is in apex.appshosting.com free demo environment. I sent them an email asking about it and they told me it was a code issue and they don't support the demo environment.

  • Help needed - OS Command foe deleting a file from Appplication server.

    Hi,
    I have requirement, where in i need to delete a file from the application server. It has to be done automatically. I thought of using OS Command for achieving the same. Can anyone help me in achieving it. The OS of my application server system is UNIX.
    Thanks in advance!!
    P.S: Points will be rewarded.

    Hello Sudeep,
    If you define the command for each operating system using transactions SM69 (You can test it with SM49) and then call it using SXPG_COMMAND_EXECUTE which contains a parameter defining the operating system (SY-OPSYS)
    then it does not matter which operating system is running, the function module always calls the correct version of the command.
    So, for example you could define a command 'OS_COMMAND'
    which deleted a file. This would have one version for Dos
    which said 'del', and a second version for unix which said 'rm'.
    The correct command would be specified by the call to SXPG_COMMAND_EXECUTE because the operating system parameter differentiates between the two commands.
    [USING PROCESS CHAINS IN SAP BW|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0a7cd90-0201-0010-49a1-d730a56895f4]
    SXPG_COMMAND_LIST_GET – Reads a list of external OS commands
    Thanks
    Chandran

  • In need of help for a command

    Hello again evryone,
    So far you guys have been of great help. Now I have another
    question. It is related to the command
    sprite(spriteNumber).intersects spriteNumber. In my last post I
    asked how to make a ball bounce realisticly, however this idea is
    now replaced by the platform at the bottom of the screen shooting
    the boxes above (Space Invaders sort of). For those who are not
    familiar with my previous post the game is: square shapes falling
    down from the top of the screen and the player has to shoot them
    all to advance with his ship at the bottom of the screen (ship is
    controlled left/right by the mouse, shoot - LMB). To detect if the
    bullet sprite has hit a box I use the command
    sprite(BulletBeingHere).intersects(BoxBeindHere). But with this
    command I do not get consistent results - it detects that the two
    sprites intersect whenever it feels like it. I cannot recorgnise a
    pattern, it is absolutely random (from my point of view). I will
    attach the piece of code I am using. Please if you can guide me
    into fixing this. I suspect I am doing something wrong with the
    sprites' properties, the sprites are bitmaps firs one is box,
    second one is oval-shaped object, both with Ink:Matte (from
    Property Inspector), so to 'merge' with background. In the code:
    custom handler detectHit, spNum is the number of the box sprite, 11
    and 12 are two bullets sprites, sprite(spNum).locV = -600 kicks out
    of the stage the box which has been hit by the bullet, sprite(11 or
    12 here).locV = 0 resets the bullets in their original position.
    P.S. I get this weird problem with Director not being able to
    publish/compile properly the project, everything is working just
    fine whilst in Director, and after publishing to exe file, either a
    critical error, or background is not displayed, or some sprite is
    not displayed. But I don't think that is related to the above
    problem.
    Thanks

    > Looks like you are not using the intersect function
    correctly (note: it does
    > not end with an "s"). It doesn't return a boolean. It
    returns a rectangle of
    > the overlap region. If they don't overlap it will give
    you a value of rect(0,
    > 0, 0, 0)
    There's nothing wrong with 'intersects()' - from the docs:
    sprite...intersects
    Usage
    -- Lingo syntax
    sprite(sprite1).intersects(sprite2)
    sprite sprite1 intersects sprite2
    Description
    Keyword; operator that compares the position of two sprites
    to determine
    whether the quad of sprite1 touches (TRUE) or does not touch
    (FALSE) the
    quad of sprite2.
    If both sprites have matte ink, their actual outlines, not
    the quads,
    are used. A sprite’s outline is defined by the nonwhite
    pixels that make
    up its border.
    This is a comparison operator with a precedence level of 5.

  • Help with PSexec command

    Hi everyone so I have this script that pulls a file from another machine and then unzips it.
    function Expand-ZIPFile($file, $destination)
    $shell = new-object -com shell.application
    $zip = $shell.NameSpace($file)
    foreach($item in $zip.items())
    $shell.Namespace($destination).copyhere($item)
    #Create directory
    New-Item -ItemType directory -Path "C:\Users\Public\Desktop\Android sdk" -Force
    #Move zip to directory
    Copy-Item "\\tsvc2552142x011\C`$\Users\cody-horton\Desktop\adt.7z" "C:\Users\Public\Desktop\Android sdk" `
    -Recurse -Force
    #Unzip file
    Expand-ZIPFile –File "C:\Users\Public\Desktop\Android sdk\adt.7z" `
    –Destination "C:\Users\Public\Desktop\Android sdk"
    #Delete zip folder
    Remove-Item "C:\Users\Public\Desktop\Android sdk\adt.7z" -Recurse
    So it works but I'm having trouble using the PSexec command. I can successfully open up the computers command prompt by using psexec  "computer name" cmd. Then if I try to run my script it doesn't work. 
    I'm not sure what I'm doing wrong or if there was a better way to do this. Thanks any help is appreciated.

    Hi thanks for the reply. I was using this command once I was using the other machines command prompt runas/user:UserName"ProgramNamePathToProgramFile"
     So I would put my user name which is an admin in AD then the path to the ps1 file I wanted to execute.

  • Help! Pressing Command and Q always launches Safari

    Hi,
    Today, out of nowhere, if I try to Quit an application other than Safari using the Command and Q keys on the keyboard, it doesn't work. What it does is launch Safari. I don't know how to get it to stop doing that.
    Does anyone know?
    Thanks in advance.
    -Dean

    Well this afternoon, I got in touch with Maxtor, because I wanted to know if there was a program that would prevent my 1TB hard drive from sleeping. The tech sent me a link to download an application that would work on a Mac Pro. Once I ran the application (Maxtor OneTouch Manager) and (SyncMyMac), I realized I couldn't find the setting to prevent the drive from sleeping.
    I again called Maxtor, and another tech said there's no such application for the Mac. So much for helping your customers and giving them the proper information.
    What I did was remove anything that had to do with installing the app's I mentioned above, so perhaps, something is preventing my keyboard from working properly.
    I'll check the start items list and see if there's anything out of the ordinary.
    Thank you again for your help.
    -Dean

  • Would like help with trap command in Terminal

    I'm learning about the trap command from my bash book. I tried out the little script they gave:
    Code: 
    trap "echo 'You hit control-C!' " INTwhile true; do     sleep 60done
    But when I type control-c, the script just stops and the message is not displayed. I checked trap -l and saw that control-c is intr, but the same thing happened whet I tried that. Can anyone tell me what I'm missing?
    I'm using terminal (BSD) in OS X Snow Leopard

    I'm assuming that you are typing these commands in the terminal window and not initiating them thru a shell script. I'd like to suggest that you avoid infinite loops. Since you are bound to orphan processes. I'm going the use the external sleep command in my examples because it affords us some time to type CONTROL-C.
    [bash-4.2.8]~ $ trap "echo '......You hit control-C'" INT; sleep 15
    ^C  
    [bash-4.2.8]~ $
    [bash-4.2.8]~ $ ^C......You hit control-C
    The trap is set but Bash does not intercept the trap because sleep is running in the foreground. The interrupt signal is sent to the command sleep.
    Let's try running sleep in the background ->
    [bash-4.2.8]~ $ trap 2 #Set SIGINT to it's default
    [bash-4.2.8]~ $ trap "echo '......You hit control-C'" INT; sleep 15&
    [1] 368
    [bash-4.2.8]~ $ ^C......You hit control-C
    [bash-4.2.8]~ $ ^C......You hit control-C
    [1]+  Done                    sleep 15
    [bash-4.2.8]~ $ ^C......You hit control-C
    It works! Well, almost. You can't send the interrupt signal to a background process. In order for Bash to intercept the trap it must stay in the foreground. This happens when you initiate a sub-shell via a shell script or by rapping a command in paretheses ( ) ->
    [bash-4.2.8]~ $ trap 2  #Set SIGINT to it's default
    [bash-4.2.8]~ $ (trap "echo '......You hit control-C'" INT; sleep 15) ^C......You hit control-C
    [bash-4.2.8]~ $
    [bash-4.2.8]~ $ ^C
    The trap works and the interrupt signal was sent to sleep. Notice, the trap is only set in the sub-shell.
    Bash behaves differently when you use the built-in commands since you are working within the shell. I'll use an example similar to one of yours, except that you can break out of the loop by typing the number 10 or higher.
    [bash-4.2.8]~ $ trap "echo '.......You hit control-C'" INT ; x=0; while (( $x < 10 )); do echo "Enter a number"; read x; done
    Enter a number
    3
    Enter a number
    ^C.......You hit control-C
    3
    Enter a number
    10
    [bash-4.2.8]~ $
    [bash-4.2.8]~ $ ^C......You hit control-C
    [bash-4.2.8]~ $ trap 2  #Set SIGINT to it's default
    As you can see the trap works. I'm going to let you sort out what happens after I typed  CONTROL -C in the last example.....:-)  Hope this helps.
    Message was edited by: Mark Jalbert

Maybe you are looking for

  • Getting error while Year end closing in asset accounting for the year ...

    Hi,     i am getting error while doing Year end closing in asset accounting for the year 2004. It is giving few assets and saying that "Depreciation not posted completely" Can any body help in this reagards. With regards,

  • Disk failing to mount after failed repair

    My g5 1.8dp is running 10.5.6. SInce I upgraded to Leopard from 10.4.11 it's been sluggish, quite unresponsive and programs are giving me the beachball a lot more often and for longer. I decided to run disk utility. It told me I needed to repair the

  • How to queue custom events with out using af:calientListener.- onKeyUp.

    Hi, I have a custom component ( extending richinput text). defined a new attribute called "onkeyup" and added necessary logic in Renderer. Some thing like write.writeAttribute("onkeyup" , "handleEvent()"); I rendered the java script code too ..... in

  • Error: cannot read: test.java

    Dear Guys, How come I get an error msg like that? My autoexec.bat is PATH C:\JDK131\BIN SET CLASSPATH=.;C:\JDK131\BIN;C:\JDK131\CODE Note: 1. I put my Java codes in C:\JDK131\CODE 2. I compile the Java code (test.java) in C:\JDK131\BIN 3. I am using

  • Can't open 192.168.1.1 during setup

    I am replacing a Netgear wireless router (WGR614v10) with a Cisco WRVS4400N.  When I go to set up the device on my Mac, 192.168.1.1 will not open in a browser.  Do I have to do the setup on a PC?  Or, am I doing something else wrong?