execute scripts with Shebang without ending | change folder to ~/autom

This commit is contained in:
lucaspalomodevelop 2023-03-08 17:59:44 +01:00
parent f5e5eb9098
commit f00154f91c
3 changed files with 3 additions and 3 deletions

BIN
src/autom

Binary file not shown.

BIN
src/main

Binary file not shown.

View File

@ -5,16 +5,16 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// make dir in /etc/autom // make dir in ~/autom
std::string home = getenv("HOME"); std::string home = getenv("HOME");
std::string dir = home + "/.autom"; std::string dir = home + "/autom";
// std::cout << "dir: " << dir << std::endl; // std::cout << "dir: " << dir << std::endl;
mkdir(dir.c_str(), 0777); mkdir(dir.c_str(), 0777);
if (argc > 1 && argv[1][0] != '-') if (argc > 1 && argv[1][0] != '-')
{ {
std::string pre_script = "cd " + dir + " && "; std::string pre_script = "cd " + dir + " && ";
std::string script = pre_script + dir + "/" + argv[1] + ".sh"; std::string script = pre_script + dir + "/" + argv[1];
system(script.c_str()); system(script.c_str());
} }
// else{ // else{