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
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 <stmt1> && <stmt2>
is shorthand for if [[ <stmt1> ]]; then <stmt2>
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.
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 inuniverse/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/<avob>
universe/planet/earth/humanbeing.vws
is the view storage, not a view tag.
Make sure that
cleartool mount /vobs/avob
)myapp/WEB-INF/scripts
is present in /view/humanbeing/vobs/<avob>
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
.
I don't have access to Clearcase to try things out but sometimes from past experience, you will need to RTFM, such tools with either accept a reverse pipe or an input script file, look in the documentation for syntax such as:
Cleartool < echo
command_sequence
echo
command_sequence | Cleartool -
or
Cleartool -f
inputfile or command sequence or
Cleartool -c
inputfile or command sequence or
Cleartool run
inputfile or command sequence or
If you do find some variant of the above does the trick please let us know by posting your own answer so that the next person with the problem can benefit.