https://github.com/syslog777/scriptcreationtool
A tool for making scripts executable
https://github.com/syslog777/scriptcreationtool
Last synced: over 1 year ago
JSON representation
A tool for making scripts executable
- Host: GitHub
- URL: https://github.com/syslog777/scriptcreationtool
- Owner: Syslog777
- Created: 2017-06-30T17:18:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-01T08:48:00.000Z (almost 9 years ago)
- Last Synced: 2025-01-19T08:48:03.706Z (over 1 year ago)
- Language: Shell
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ScriptCreationTool
A tool for making scripts executable.
This is a quick app I wrote for making scripts executable.
The main script so far contains this simple code written in Bash.
```
#!/bin/bash
echo 'Please enter a valid path to your script(s).'
read path
echo $path | java -jar ConvertToExecutable.jar
```
ConvertToExecutable is a simple class that does a few things.
* This java app will run a special command
* that will change the properties of files
* in a given directory with specific properties
* For compactness, all code will be placed within
* one file.
*
* This is not meant to be run by a normal user.
* Another scrip will run this app.
* With that being noted, certain variables will
* be initialized without asking requesting data
* from STDOUT.
*
* All files that are to be executable should
* have the .sh extention. All files must also not
* contain any empty spaces.
```
package bundle;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class ConvertToExecutable
{
static String path;
static File directory;
static File[] listOfFiles;
static Scanner sc;
static Runtime run;
public static void main(String[] args)
{
sc = new Scanner(System.in);
path = sc.next();
directory = new File(path);
listOfFiles = directory.listFiles();
run = Runtime.getRuntime();
for (File script: listOfFiles)
{
try
{
run.exec("chmod u+x " + script);
System.out.println(script + " has been set as executable.");
} catch (IOException e)
{
e.printStackTrace();
}
}
}
}
```
Simply open up a terminal, cd to the folder ScriptCreationTool, and type ./MakeScriptsExecutable.sh.
You will be prompted to enter the directory of the scripts you want to make executable. After you enter it presd enter.