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 …
Tag: linux
Split lines from a file into variables (accepting spaces) BASH
I need a script in bash that reads a file and recognize an delimiter (“;”) and store the values between the delimiters into variables to build a dialog menu later. What i’ve done: the file that it reads is : And the output: Answer With a while you can split a line into a lot of vars in 1 cal…
“xargs -a file” to copy files to a folder
I am tring to use xargs -a to read the contents of a file that has a list of filenames in it. My directory working in looks like: File name with filenames in it: bakfiles.txt bakfiles.txt contents: So essentially I’m trying to copy file1.bak,file2.bak,file3.bak into the folder backups. But using the con…
BASH: Check if user is root even when using fakeroot [duplicate]
This question already has answers here: How to check if running as root in a bash script (21 answers) Closed 23 days ago. How can I check whether a user is root or not within a BASH script? I know I can use or but if the script was invoked via fakeroot, UID and EUID are both 0 (of course,
Can mmap and O_DIRECT be used together?
As I understand it, when you mmap a file you are basically mapping the pages from the page cache for that file directly into your process, and when you use O_DIRECT you are bypassing the page cache. Does it ever make sense to use the two together? If my understanding is right how would it even work? mmap seem…
OpenSSL verify_callback and SSL_connect
The SSL_CTX_set_verify() and SSL_set_verify() calls can be used to set the verify_callback() function for the underlying context and ssl, respectively. Here is a snippet from the documentation of verify_callback(): The return value of verify_callback controls the strategy of the further verification process. …
How to read and update(increment) a value in a file with shell commands
I have a certain file which contains many contents, including a line from the format (for example) ABC = “x12” What I need to do is to increment the value, so that after the command it will be ABC = “x13” The file itself needs to be updated, no need to create a new file or something si…
OpenSSL and Trusted System Certifcates
So I already know how to specify locations for trusted certificates using SSL_CTX_load_verify_locations(). Now the documentation says the following: SSL_CTX_load_verify_locations() specifies the locations for ctx, at which CA certificates for verification purposes are located. The certificates available via C…
Programatically activate and deactivate network interfaces using nmcli
I wrote a script that deactivates all the interfaces available using nmcli commands such as: I would now like to reactivate these interfaces; there is no nmcli dev connect iface … command, and I’m stuck. In particular, my problem is to reactivate the Ethernet interface. Thanks in advance for your help! …
core dumped message is not captured in STDERR
I used to call my program with this line in bash shell to capture all stdout and stderr messages in the log file The log file shows no error but by examining the log, it’s obvious that there’s a problem and program terminates abruptly in the middle of execution. I have also tried these but the res…