我遇到了产生乱序输出的 bash 脚本的问题。
该脚本在多个地方使用,通常可以正常工作。
然而,在一个特定的目录中,它完全不同步并使其输出文件无用。
目录结构相同,其输入数据也非常相似。(在 ClearCase 中工作,如果这有影响的话。)
当 bash 正常运行时,它的输出如下所示:
Techpack Meta Version is currently 3, has this changed? y/n n
Have Techpack Version Dependencies changed? y/n n
Updating Version Properties
Building TPI File
Inside make_tpi_file
Created ../package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi
Checked out "package/12.0/" from version "/main/at_job/1".
Created element "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" (type "compressed_file").
Created branch "at_job" from "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" version "/main/0".
Checked out "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" from version "/main/at_job/0".
Checked in "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" version "/main/at_job/1".
Checked in "package/12.0/" version "/main/at_job/2".
当 bash 不起作用时,它的输出如下所示:
Techpack Meta Version is currently 3, has this changed? y/n n
Have Techpack Version Dependencies changed? y/n n
Updating Version Properties
Building TPI File
Inside make_tpi_file
_R0E_b1.tpipackage/12.0/M_E_HANF_DATAGEN
Checked out "package/12.0/" from version "/main/at_job/4".
_R0E_b1.tpi" (type "compressed_file").A_DATAGEN
_R0E_b1.tpi" version "/main/0".package/12.0/M_E_HANF_DATAGEN
_R0E_b1.tpi" from version "/main/at_job/0".
_R0E_b1.tpi" version "/main/at_job/1".GEN
Checked in "package/12.0/" version "/main/at_job/5".
/vobs/job/job_mg/test_tools/Data_Generator/HANF/FeatureTest/build
Checked in "install/version.properties" version "/main/at_job/14".
Checked in "../package/12.2/build.number" version "/main/at_job/4".
一般来说,什么会导致 bash 脚本产生这样一个错误的输出?
考虑到它适用于许多目录,我认为问题不在于代码本身,而在于脚本读取的数据。