Send Text To STDOUT Without A Newline In JXA/OSA Script
#!/usr/bin/env osascript -l JavaScript
ObjC.import('Foundation');
const send_stdout = (text) => {
$.NSFileHandle.fileHandleWithStandardOutput.writeData($.NSString.alloc.initWithString(String(text)).dataUsingEncoding($.NSNEXTSTEPStringEncoding))
}
-- end of line --
References
-
This is where I found the code. The original version took multiple arguments. I switched it to a single text in put