Clearcase running commands from a script (error: Bad phone number)

杀马特。学长 韩版系。学妹 提交于 2019-12-24 09:14:40

问题


Hoping someone might have some insight here. I have a small shell titled xrunner.sh.

#!/bin/bash
ct checkout -nc parentFolder
cd parentFolder/
ct mkdir -nc directory
ct checkin -nc directory
cd ..
ct checkin -nc parentFolder
pwd

When the commands are run individually on the CLI they all work fine, When run from the bash however the following is thrown back at me:

ct: bad phone number -- parentFolder
ct: bad phone number -- -nc
ct: bad phone number -- checkout
: No such file or directory
ct: bad phone number -- directory
ct: bad phone number -- -nc
ct: bad phone number -- mkdir
ct: bad phone number -- directory
ct: bad phone number -- -nc
ct: bad phone number -- checkin
: No such file or directory
ct: bad phone number -- parentFolder
ct: bad phone number -- -nc
ct: bad phone number -- checkin

Would anyone happen to know why this is or point me to some web reference that explains this? Thanks in advanced.


回答1:


That means you don't have defined the alias 'ct' properly

add:

alias ct=/path/to/cleartool

Note: if you want to add a directory to source control, don't forget to call mkelem

cleartool mkelem -mkpath dir1 -c "a comment"

See "Command line add to Source control of a directory with files in a dynamic view returns Error".

Notes:

  • as this thread suggests, even if the alias is already defined, a ct setview won't allow further ct commands to work, because setview spawns a sub-shell. See for instance "Python and ClearCase setview" for more on setview.
    So ct will work, except if you have further ct commands in a script after a ct setview.
  • Just for information, here the the man page for the /usr/bin/ct command
    ct(1)
    NAME
    ct - spawn getty to a remote terminal (call terminal)

The UNIX command "/usr/bin/ct" dials a phone number, where a modem connected to a terminal should be awaiting for the call, and then spawns a getty(1M) process to that terminal.
The "getty" process sets the terminal type, modes, speed and line discipline, and then invokes the "login" process, which in turn will execute a shell when a user authenticates correctly.




回答2:


The problem you get with ct: bad phone number... is because there is actually another binary called ct. You can run type -p ct in bash to find which (too many years since I had the same problem so I do not remember where it was (/usr/xpg4/bin ??)).

So as VonC suggest, make an alias for ct.



来源:https://stackoverflow.com/questions/10416063/clearcase-running-commands-from-a-script-error-bad-phone-number

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!