# cordova-plugin-shell-exec **Repository Path**: codeox/cordova-plugin-shell-exec ## Basic Information - **Project Name**: cordova-plugin-shell-exec - **Description**: Apache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell - **Primary Language**: TypeScript - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-08-02 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # cordova-plugin-shell-exec Apache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell ### Supported Platforms * Android ### Installation `$ cordova plugin add https://github.com/petervojtek/cordova-plugin-shell-exec.git` ### Usage ``` window.ShellExec.exec(cmd, callback) ``` `cmd` can be either a single string or an array of string arguments. callback function will return a hash with two keys - `exitStatus` and `output`. Example: ``` window.ShellExec.exec('uptime', function(res){ console.log('exit status: ' + res.exitStatus) console.log('cmd output: ' + res.output) }) ``` JS console output: ``` exit status: 0 cmd output: up time: 10 days, 05:16:51, idle time: 17 days, 01:22:57, sleep time: 5 days, 16:38:37 ``` If command execution fails (e.g. you enter wrong command), you receive exit status `100`. Example with root: ``` window.ShellExec.exec(['su', '-c', 'touch /sdcard/test.txt'], function(res){ console.log('exit status: ' + res.exitStatus) console.log('cmd output: ' + res.output) }) ``` ### How to Contribute Use pull request.