Topic
2 replies Latest Post - ‏2013-09-09T01:43:01Z by Dave-Robinson
keyforone
keyforone
1 Post
ACCEPTED ANSWER

Pinned topic How to run multiple clearcase command in one step?

‏2013-09-03T05:00:09Z |

Question:  If I want to list  all the subdirectory  in /vobs/proj_xxx/ which is managed by clearcase, i have to run two commands in shell step by step like below 

1.  cleartool setview  your_own_view

2. ls -d /vobs/proj_xxx/* 

This will works.

But If I want to run those two commands in one step like this  "cleartool setview  your_own_view;  ls -d /vobs/proj_xxx/* ", it does not work and I don't know why.

Is there anyone can help me on this ? Thanks in advance.

  • marcdb
    marcdb
    16 Posts
    ACCEPTED ANSWER

    Re: How to run multiple clearcase command in one step?

    ‏2013-09-03T06:48:28Z  in response to keyforone

    When you execute "cleartool setview your_own_view" this way, the subshell for the cleartool setview is closed after the ;.

    The following construction seems to work (mind the -e option in the echo command, to ensure that the \n is handled correctly):

    echo -e "cleartool setview your_own_view \nls -d /vobs/proj_xxx/*" | cleartool

    As an alternative, you could also write both subcommands into a file and then let the cleartool command read the contents of this file:

    echo -e "cleartool setview your_own_view \nls -d /vobs/proj_xxx/*" > ct.cmd
    cleartool < ct.cmd

    Regards,
    Marc

  • Dave-Robinson
    Dave-Robinson
    116 Posts
    ACCEPTED ANSWER

    Re: How to run multiple clearcase command in one step?

    ‏2013-09-09T01:43:01Z  in response to keyforone

    There are two other ways to achieve what you want:

    1.  Note the syntax for setview:

    %cleartool help setview
    Usage: setview [-login] [-exec command-invocation] view-tag


    Hence:

    cleartool setview -exec "ls -d /vobs/proj_xxx/*" your_own_view

    2. Use a "working view" instead of a "set view"

    ls -d /view/your_own_view/vobs/proj_xxx/*