Hi guys as the title says i need a way to execute multiple commands in the same shell with a timer. For example let's say i want to open a shell and execute a simple "ls" followed by a "mkdir hello" after 10 seconds from the first command.
Can you provide me some example? thanks :)
This is a very bad piece of code which doesn't do what i want of course.
I could use a "usleep" but i don't think it'll work. And i know that "system()" is not very safe to use due to security reasons.
any idea on how should i actually write the code? 🤨
Can you provide me some example? thanks :)
This is a very bad piece of code which doesn't do what i want of course.
Code
#include <iostream>
#include <stdlib.h>
#include <ctime>
#include <cerrno>
#include <unistd.h>
#include <chrono>
#include <thread>
int main() {
system("gnome-terminal -x sh -c 'ls; mkdir hello; exec bash'");
return 0;
}I could use a "usleep" but i don't think it'll work. And i know that "system()" is not very safe to use due to security reasons.
any idea on how should i actually write the code? 🤨



![[Image: lKhgahK.gif]](https://i.imgur.com/lKhgahK.gif)