tempExecutableScriptFile function
Writes content
as executable *.sh file in a temp directory
The file name is the md5 hash of the content, therefore doesn't create a new file when called with the same content
Implementation
io.File tempExecutableScriptFile(String content, {Directory? tempDir}) {
final io.Directory dir = tempDir ?? Directory.systemTemp.createTempSync();
final script = dir.file('${content.md5}.sh')..createSync(recursive: true);
script.writeAsStringSync(content);
posix.chmod(script.path, permission: '755');
return script;
}