Ducttape 风管磁带:有时跳过任务:在多个变量上分支
关于这个问题: 假设我有这样一个计划:Ducttape 风管磁带:有时跳过任务:在多个变量上分支,ducttape,Ducttape,关于这个问题: 假设我有这样一个计划: task map_lexicon < in_lexicon=$pron_lex > out_lexicon=lex > out_w2p=lex.w2p > out_p2w=lex.p2w { cp $in_lexicon $out_lexicon echo "" > $out_w2p echo "" > $out_p2w } task prune_lexicon
task map_lexicon
< in_lexicon=$pron_lex
> out_lexicon=lex
> out_w2p=lex.w2p
> out_p2w=lex.p2w
{
cp $in_lexicon $out_lexicon
echo "" > $out_w2p
echo "" > $out_p2w
}
task prune_lexicon
# Prunes a lexicon
< in_lexicon=$pron_lex
> out_lex_pruned=lex.pruned
> out_w2p_pruned=lex.w2p.pruned
> out_p2w_pruned=lex.p2w.pruned
{
cp $in_lexicon $out_lex_pruned
echo "" > $out_w2p_pruned
echo "" > $out_p2w_pruned
}
global {
lex1=/path/to/foo
pron_lex=(PronLex: Lex1=$lex1)
}
有没有一种方法可以设置一个有时跳过的任务来管理一个分支点内的三个变量?结果表明,所有必要的是使用相同的分支点定义其他变量
global {
lex=(LexType: raw=$out_lexicon@map_lexicon pruned=$out_lex_pruned@prune_lexicon)
w2p=(LexType: raw=$out_w2p@map_lexicon pruned=$out_w2p_pruned@prune_lexicon)
p2w=(LexType: raw=$out_p2w@map_lexicon pruned=$out_p2w_pruned@prune_lexicon)
}
然后将foo定义为:
task foo
< in_lex=$lex
< in_w2p=$w2p
< in_p2w=$p2w
> bar
{
echo $in_lex $in_w2p $in_p2w > bar
}
taskfoo
酒吧
{
echo$in_lex$in_w2p$in_p2w>条
}
是的。您还可以将这些变量放入任务声明中。或者在全局块中。随便哪个适合你。
task foo
< in_lex=$lex
< in_w2p=$w2p
< in_p2w=$p2w
> bar
{
echo $in_lex $in_w2p $in_p2w > bar
}