I can tail -f the last modified file using ls –sort=time | head -1 | xargs tail -f but I’m looking for something that would continuously run the first part as well, i.e. if a new files is created while the tail command is running it switches to tailing the new file. I thought about using watch com…
How can one influence the order of RUN commands in a Dockerfile?
I’m writing a Dockerfile where the root user creates a user named blog to manage website deployment. I’m using the Docker Hub wordpress container as a base. The root user creates folders under /var/www/html and gives the blog user permissions to write underneath. In the next set of RUN commands fo…
How can gcc/clang assume a string constant’s address is 32-bit?
If I compile this program: for x86-64, the asm output uses movl $.LC0, %edi / call puts. (See full asm output / compile options on godbolt.) My question is: How can GCC know that the the string’s address can fit in a 32bit immediate operand? Why doesn’t it need to use movabs $.LC0, %rdi (i.e. a mo…
How do I search for a certain piece of text inside of a variable?
I am working on a script which prompts the user for their username. Once entered, the script uses the ‘rwho’ command to get a list of users who are logged into the network. It should crosscheck the text they entered (their username) with the results from the rwho command. If a match is found then …
How to configure Java 7 OR Java 8 dependency in Debian deb package?
I am building a Debian *.deb package for our proprietary software. The software is Java based, so I thought it would be good if the deb package checks for an installed Java package first. Problems: This fails if an Oracle JDK 7 is installed. It seems as this would only check for the OpenJDK 7 package. How can…
How to force HTTP to HTTPS with an exception?
So I had to force all connections via HTTP to go to HTTPS on a specific folder (e.g. “public_html/folder1”). I found a tutorial somewhere and used the following in an .htaccess file: Problem is, I have a folder inside that folder1 which should be allowed to be accessed via HTTP and not just HTTPS,…
Read and run different command based on each line of file in Bash Linux?
I am completely new to bash scripting. I am trying to write a script in order to read line by line recent_log.txt which has the following content: and then run the command below for each line depend on the suffix. Output should be in another file. each output should have 2 lines space between them. This is my…
Can bash be used to communicate directly with hardware?
I am interested in writing my own tool in bash to act in place of my current network controller (wpa_supplicant) if possible. For example if I want to issue commands in order to begin a wps authentication session with a router’s external registrar, is it possible, without using any pre-built tools, to c…
How can I find the bridge device name for my tap adapter in C?
On Linux, using C, how can I find the find the name of the bridge device my ethernet interface is attached to? Is there a sequence of ioctl() calls I need to make to find the master bridge device? My C program knows the device name of my TAP adapter from a configuration file (in this case, tap0). Ultimately, …
Pointers and virtual memory [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago. Improve this question According to my system’s cpuinfo file, each processor in my system has a 39 bit physic…