How to run multiple Unix commands in one shot

后端 未结 3 1677
终归单人心
终归单人心 2020-12-04 00:37

I am trying to execute multiple commands in one shot but to my surprise only the first command is getting executed and the rest are skipped. And the command is



        
3条回答
  •  庸人自扰
    2020-12-04 01:21

    Don't use cleartool setview: it forks the current shell in a subshell, which is why the rest is skipped when executed in a single line.
    And which is why it works when executed one by one (the last two are executed in the subshell)

    Always work with the full path of the dynamic view: /view/aview/vobs/avob/..., instead of setview (which you don't need).

    If you must use cleartool setview, then use it with the -exec option (as in this answer):

    cleartool setview -login -exec "command 1; command 2; command 3" view_tag
    

    In your case:

    cleartool setview -exec 'cleartool setactivity activity456 ; cd /vobs/app/src/epw/WEB-INF/scripts ; pwd' view1234 
    

    Without setview:

    The OP asks:

    Say my view named humanbeing is in universe/planet/earth/humanbeing.vws

    How do I use the startview command?
    Is it something like

    cleartool startview universe/planet/earth/humanbeing
    

    or

    cleartool startview cd universe/planet/earth/humanbeing
    

    In both the cases it says the Error: Couldn't set view tag universe/planet/earth/humanbeing

    To be sure, do a cleartool lsview -s | grep humanbeing: that will give you the view tag.

    That should be:

    cleartool startview humanbeing
    cd /view/humanbeing/vobs/
    

    universe/planet/earth/humanbeing.vws is the view storage, not a view tag.

    Make sure that

    • is mounted (cleartool mount /vobs/avob)
    • myapp/WEB-INF/scripts is present in /view/humanbeing/vobs/

    Don't try to do any symlink in /vobs: /vobs is a special MVFS (Multi-Version FileSystem) mounting point, not a regular folder.
    Make sure your webapp search for apps in another path than /vobs.

提交回复
热议问题