How to run multiple Unix commands in one shot

后端 未结 3 1682
终归单人心
终归单人心 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:19

    I'm not sure exactly what you are trying to do as it seems to be part of a larger problem space, but ...

    cleartool setact -view view1234 activity456 
    

    works to set an activity in the view, then

    cd /view/view1234/vobs/app/src/epw/WEB-INF/scripts
    

    will get you there. Or slap them together to get your result:

    cleartool setact -view view1234 activity456 && cd /view/view1234/vobs/app/src/epw/WEB-INF/scripts && pwd
    

    The statement && is shorthand for if [[ ]]; then

    See KSH man page for more information on executing unix commands "in one shot".

    A semicolon (;) causes sequential execution of the preceding pipeline; an ampersand (&) causes asynchronous execution of the preceding pipeline (i.e., the shell does not wait for that pipeline to finish). The symbol |& causes asynchronous execution of the preceding pipeline with a two-way pipe established to the parent shell; ... The symbol && ( | | ) causes the list following it to be executed only if the preceding pipeline returns a zero (non-zero) value.

提交回复
热议问题