mirror of
https://github.com/lucaspalomodevelop/autom.git
synced 2026-03-12 23:27:21 +00:00
execute scripts with Shebang without ending | change folder to ~/autom
This commit is contained in:
parent
f5e5eb9098
commit
f00154f91c
@ -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{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user