I'm trying to execute the "history" command from a Mac App written in Swift.
@discardableResult
func shell(_ args: String...) -> Int32 {
let task = Process()
task.launchPath = "/bin/bash"
task.arguments = args
task.launch()
task.waitUntilExit()
return task.terminationStatus
}
shell("history")
It always return me this error:
env: history: No such file or directory
What is wrong? It's really possible to work with the user command line history from a Mac App?