Skip to content

Tag: linux

Terminal closes when I source my script (run with dot at the start)

Here is my code: The problem is that when I start it like this or without argument, it just closes. I know that the reason for that is exit. Is there any way correct my code so I could start a script with dot at start and terminal wouldn’t close after execution? I don’t want to start it like this:

Understand the basic concept of a Makefile

I have the following makefile which I am trying to upgrade, but there is a certain element which I am not able to understand what means: I understand that $(OBJDIR)/%.o: is obtained by executing the f90 compiler with flags etc. But why do I need the %.o rule, and what does @make mean. Am I missing a general u…

Use find command with -perm and -maxdepth [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 …

Why is linear search so much faster than binary search?

Consider the following code to find a peak in an array. If I compile with -O3 and use the linear search solution (the peak function) it takes: If I use the binary search solution which should be much faster (the peak_rec function), it takes: I tried turning off optimization but this didn’t change the si…

read() hangs on zombie process

I have a while loop that reads data from a child process using blocking I/O by redirecting stdout of the child process to the parent process. Normally, as soon as the child process exits, a blocking read() in this case will return since the pipe that is read from is closed by the child process. Now I have a c…

Towards understanding availability of xdg-open

I want to open an image, and in Windows I do: I would like to use a Linux approach, where it’s so much easier to run something on the fly. Example: In my Ubuntu, it works. However, when running that in Wandbox (Live Demo), or in any other online compiler, I would most likely get an error: sh: 1: xdg-ope…