I need your help with a bash >= 4 script I’m writing. I am retrieving some files from remote hosts to back them up. I have a for loop that iterate through the hosts and for each one tests connection and the start a function that retrieves the various files. My problem is that I need to know what gone
Tag: linux
Using variables as the input to command
I’ve scoured various message boards to understand why I can’t use a variable as input to a command in certain scenarios. Is it a STDIN issue/limitation? Why does using echo and here strings fix the problem? For example, As you can see I get the error… ‘File name too long’ Now, I …
Get last 30 minutes from log file
I have a log file that contain logs as follows 1486307866.155 is the time in unix format with corresponds to 2017-02-05 07:17:46 (Format : Y-m-d H:i:s) I need a unix command that give me the logs within last 30 minutes in the following format and discarding any details that i don’t need. 2017-02-05 07:1…
Processing stdout and stderr separately adding a timestamp: Wrong order
These are my test files: std-test.sh: process.sh: std-test.sh creates twenty lines containing their line number, and process.sh is able to read another commands output when piped to it, while it saves to stderr when err is passed to it as argument, and to stdout when out is passed. The command I use to test t…
If I want to empty a directory, is there any reason I shouldn’t remove it and recreate It?
I’ve looked at these two threads for emptying a directory: Removing a non empty directory programmatically in C or C++ Delete folder and all files/subdirectories However, the functions for emptying a directory given as answers to those threads are very complex, and one answer can encounter a stack overf…
How to implement seting up ssh tunneling to port… here? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
How To replace leading zero with spaces in linux?
i have text like this i want to the result like this i have been searching all over and get no result, please help Answer With gawk you can use gensub: Or same pattern with sed:
Why boost::aio is asynchronous when its implementation is based on epoll(synchronous)
We know: (1) epoll is synchronous, based on user query/system notify. A while loop is used to call all woke up fds. (2) boost::asio declares itself to be “asynchronous”, but its implementation on linux is using epoll. My question is: how can you implement “asyn” using a “syn̶…
“Linux aio” and “Linux native aio” are the same thing?
I’m recently digging into linux io model, and I frequently hear that like windows IOCP, linux has its own aio model implementation: Glibc aio and kernel aio. Question: (1) when people say “linux native aio”, which model is indicated? (2) I hear 2 different terms, “linux aio” and …
Compiling standalone ASIO with Makefile on Linux
I’m trying to compile a small c++ program that captures an image from a camera using libv4l2 and then sends it over UDP to a separate computer using asio. The file structure of the project is: My Makefile for the project is: However, when I try to compile this, my compiler spits on dozens of undefined r…