使用Korn Shell脚本锁定清晰标签类型



我试图使用korn shell脚本锁定标签类型,但我无法锁定。
因为我是Korn脚本的新手可以帮助我。

这是我当前的代码:

cmUsers="user1,user2";
myuserName=$ENV{LOGNAME};
#checking whether current user is part of cmUsers list or not.
if [[ "$cmUsers" =~ m/$myUserName/i ]]
# if user belongs to cmUsers list, then trying to lock the lable type,
# if it fails exiting the process, else printing the success message
  "ct lock -nuser "$cmUsers" lbtype:${label}@/vobs/admin_rec" ;then
    die"Unable to lock label type: "${label}"n";
  else
    print "Label ${label} has been successfully locked by $cmUsers"
  fi

shebang 之外,一个简单的提示是避免在脚本中使用别名(ct):使用完整的命令cleartool代替。

另请参阅" KSH脚本"one_answers" KSH类"

#!/bin/ksh
cmUsers="user1,user2";
myuserName=$ENV{LOGNAME};
#checking whether current user is part of cmUsers list or not.
if [[ "$cmUsers" =~ m/$myUserName/i ]]; then
    # if user belongs to cmUsers list, then trying to lock the lable type, 
    # if it fails exiting the process, else printing the success message
    cleartool lock -nuser "$cmUsers" lbtype:${label}@/vobs/admin_rec"
    if [ $? -ne 0 ]; then
        echo "CRITICAL: Unable to lock label type: "${label}""
        exit 1
    fi
    echo "Label ${label} has been successfully locked by $cmUsers"
fi

但是,像$ENV{LOGNAME}这样的表达式指出了它可能不是KSH或任何其他外壳,而是Ratperl(如果您使用的是clearcase 7.x或更多):请参阅"关于ratlperl及其对cqperlccperl的影响"

在这种情况下,请删除Shebang,然后尝试使用以下方式执行您的脚本。

ccperl yourScript.pl 

相关内容

  • 没有找到相关文章

最新更新