1
我正在寻找一个健全的方式挖空bash中的一种功能的文件中删除文本块,我不能肯定如何使用SED(虽然我觉得无论是awk或者sed将是删除这么多数据这里最好的解决方案)从使用bash
我有一个在他们
....
function InstallationCheck(prefix) {
if (system.compareVersions(system.version.ProductVersion, '10.10') < 0 || system.compareVersions(system.version.ProductVersion, '10.11') >= 0) {
my.result.message = system.localizedStringWithFormat('ERROR_0', '10.10');
my.result.type = 'Fatal';
return false;
}
return true;
}
function VolumeCheck(prefix) {
if (system.env.OS_INSTALL == 1) return true;
var hasOS = system.files.fileExistsAtPath(my.target.mountpoint + "/System/Library/CoreServices/SystemVersion.plist");
if (!hasOS || system.compareVersions(my.target.systemVersion.ProductVersion, '10.10') < 0 || system.compareVersions(my.target.systemVersion.ProductVersion, '10.11') >= 0) {
my.result.message = system.localizedStringWithFormat('ERROR_0', '10.10');
my.result.type = 'Fatal';
return false;
}
if (compareBuildVersions(my.target.systemVersion.ProductBuildVersion, '14A388a') < 0) {
my.result.message = system.localizedString('ERROR_2');
my.result.type = 'Fatal';
return false;
}
if (compareBuildVersions(my.target.systemVersion.ProductBuildVersion, '14B24') > 0) {
my.result.message = system.localizedString('ERROR_2');
my.result.type = 'Fatal';
return false;
}
return true;
}
....
这些功能块,我想他们最终会像这虽然
function InstallationCheck(prefix) {
return true;
}
function VolumeCheck(prefix) {
return true;
}
什么是实现这一目标的最优化的方式文件?
编辑
所以每个人都知道,有这个文件应该保持不变内的其他功能。
这将如何影响,THI其他功能虽然文件?看看你是如何匹配'函数'我相信它会推动文件内的所有其他功能。 – ehime
我已经更新了我的答案。 – Cyrus
upvoted和接受,谢谢 – ehime