47,652 questions
1
vote
0
answers
15
views
Why the exit print more strlines in my screen?
I try to make a variation of "cut -c5- " with c using pipes and forks. When i run the program and giving a small .txt file to see if it runs, the program prints me more lines than the file ...
1
vote
0
answers
19
views
Why doesn't syslog's LOG_PERROR option cause the log priority to be printed?
The standard library for syslog allows you to specify the LOG_PERROR flag which causes syslog calls to additionally write the log message to stderr. I'm able to get it to print the message just fine, ...
0
votes
0
answers
25
views
unix package for R version 4.4.* [closed]
I did not manage to install unix in R version 4.4.1. Is there a way I can do it without having to go back to previous versions of R?
Thanks in advance
I tried the code available at Jeroe's website but ...
1
vote
0
answers
10
views
Is `flock` per-OFD or per-process-per-file?
man 2 flock on Linux says:
[L1]
Locks created by flock() are associated with an open file description (see
open(2)). This means that duplicate file descriptors (created by, for ...
4
votes
4
answers
87
views
Awk matching patterns and removing adjacent lines
I've got the volumetric data from different brain regions and I'm trying to sort it out to make the analysis easier. To get an idea this is a part of what I've got:
LT_Putamen 5075 5075.000000
...
3
votes
1
answer
86
views
How to get original argv[0] in shebang interpreter
I'm writing a program that's intended to be used as a shebang interpreter
#!/usr/bin/my-program
# some-file
When I execute some-file my program is executed with argv[0] = /usr/bin/my-program and argv[...
2
votes
1
answer
68
views
Why is the double dot(parent directory) acting weird with the bin folder?
I started studying bash from the very beginning. I decided to practice using shortcuts for the current directory and the parent directory (dot and double dot). I noticed some strange behavior of the ...
0
votes
0
answers
19
views
How can a TTY program work while stdout is piped to less?
I'm writing a text UI program that writes its output to and reads input from /dev/tty. It configures the alternative buffer, sets the terminal to raw mode, etc. It seems to work great, even when ...
0
votes
2
answers
42
views
Copy files from source directory to destination directory, following symlinks in destination directory
I'm trying to copy some files from one directory to another and resolve all symlinks in the destination directory. To better illustrate what I'm saying, my source directory looks something like this:
...
-1
votes
2
answers
77
views
New line character within data giving issues while loading using IICS [duplicate]
we have a pipe delimited file qualified by double quotes. Some columns have free text data with newline and special characters(" representing inches) in it. When we try to ingest this data in ...
0
votes
2
answers
59
views
AWK command not working as expected giving & data as output [duplicate]
I have file where I need to find if some column is empty. File is delimited by ;
Some of data contains & in word and awk is command it not working for same .
lets say I have file( ...
-3
votes
1
answer
44
views
How to create a script that copies and renames a file to a certain folder?
I'll explain the scenario better: I set up a karaoke "system" with a frontend called Attract Mode, in Linux Mint 22, where the videos are played by VLC. The command line that plays the video ...
0
votes
0
answers
27
views
Memcache not closing connections with close()?
The below code snippet will show 2 current connections present even after running the close() function.
$memcache = new Memcache;
$memecache->connect('unix:///var/run/memcached/memcached.sock:0');
...
-2
votes
0
answers
18
views
How to delete Linebreaks or \n or LF from each field in a line in .DAT file by leaving last \n RS(Record separator at end of line) using unix script
I want to remove line breaks or \n within a field in each line that has multiple fields in a file in unix.
Example:
DAT file input:
11 abd efg tru
12 qwr
yut iris
13 mnb asd lkj
Expected output in ...
-2
votes
1
answer
45
views
Solaris 10 make Error code 1 Fatal Error when trying to build python 2.7.16
I am trying to get Python 2.7.16 working on my Solaris 10 installation I have Oracle Developer Studio 12.6 I downloaded the XZ compressed source tarball from python downloads Then I extracted it and ...
1
vote
1
answer
41
views
Remove Windows line ending without altering timestamp
I have a problem where files transferred into my Solaris server automatically arrive with Windows line endings ^M at the end.
Normally I fix this using this command:
find . -type f -exec dos2unix {} {}...
0
votes
1
answer
30
views
How to base64 decode a sed output using piping
I have a lambda that I want to invoke using CLI. The LogResult in the output is base64 encoded data. I am trying to fetch the log data in "LogResult", remove the preceding and following ...
0
votes
0
answers
50
views
Debugging on remote machine CMake project using Visual Studio 2019 launch.vs.json
I'm trying to debug my binary (crosscompiled C++ with VS CMake project) on remote host (Unix-like) with launch.vs.json.
I've created CMake project in Visual Studio 2019 (Version 16.11.42).
Using ...
-2
votes
2
answers
102
views
Can someone help me understand a typecast of a sockaddr reference when calling bind()?
I'm working on a small C++ program. The goal right now is to bind a TCP socket. I'm currently working on Arch Linux.
Here is the code I've currently written.
#include <iostream>
#include <...
1
vote
1
answer
71
views
How Do I Run A Command In Bash Using Specific Version of Python
I have a website which runs on a VPS and I use CyberPanel for some admin purposes. A week or two ago I received an email saying I should update the version of CyberPanel as it was vulnerable. When I ...
-3
votes
3
answers
208
views
Reading patterns from config file to replace matching occurrence but AWK jumbles up and gsub fails to remove special characters and space [closed]
I am trying to replace a lot of patterns stored in list_file1 which match similar data in field 2 of data_file1 and then replace it completely from data_file1.
The data_file1 should match both upper ...
0
votes
0
answers
26
views
Error when calling SQL Server JDBC driver in Solaris
Has anyone had an experience with using SQL Server JDBC driver in Solaris?
I downloaded the driver from this link:
https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-...
0
votes
0
answers
40
views
how to fix the db.sqlite file in nixos?
[root@nixos:/mnt/etc/nixos]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 512M 0 part /boot
│ /boot
├─sda2 8:2 ...
0
votes
1
answer
27
views
I want to check if query - select * from ignTestt1 exists in following input string (either using java substring or linux commands)
Note : Query can be distributed in different patterns and on multiple lines having hexadecimals in between, so looking for a concrete solution
for eg. in another set, sel can be on first line, ect * ...
1
vote
1
answer
94
views
Given a path to a logical volume get UUID without root
My question is simple, given a path to a logical volume: is it possible to get the UUID of the device it belongs to, without the need of root access in C? and if so, how would you approach this ...
1
vote
1
answer
35
views
How to display a box for each environment defined in Latex and actually created with \begin{env} \end{env} syntax
I have defined an environment, called question, in which I write some questions. This environment is a simple wrapbox, but it allows me to display the question as I want.
I would like to add a new ...
1
vote
1
answer
75
views
Capturing errors from output of a command, detecting them in text processing pipeline
the following section of a bash (RHEL 7) script invokes a SELECT SQL on the Ingres sql command, if the query is successful, returns results in text format with a log of the query itself, followed by ...
1
vote
0
answers
105
views
How can I define a function with structures in C? [duplicate]
I'm working on a C program with the following files:
functiontest.h
double funcCmp(double(*func1)(double), double(*func2)(double),
double xM, double xI, int xN, enum NormType ntype) {
...
2
votes
1
answer
117
views
C & Unix on Kubernetes - exit(0) doesn't work
I tried to run my C-program on my local kubernetes-cluster and on the first look all functions are working as I expect.
Only my signal-handler for terminating one process doesn't work completely.
...
1
vote
0
answers
102
views
write syscall with mmaped buffer
I work with large files and as a result of development I had to copy large files (about 10 gigabytes) in C code.
In this regard, the question arose: how effective is the combination of map()+write() (...
-1
votes
1
answer
91
views
Fibonacci script
I have this Fibonacci script
#!/bin/bash
if (test $# -ne 1) then
echo "Use: $0 number"
exit 1 fi
for c in ‘seq 1 $1‘
do
if (($c == 1))
then
n0=1;
echo "fibonacci(1)=$n0";
...
2
votes
1
answer
103
views
How to account for destination being file or directory in cp implementation in c
I am writing a pseudo-shell in c for a class and my cp command needs to account for the destination being a file or a directory. I realized after I implemented everything I currently only truly ...
0
votes
1
answer
64
views
Kill syscall not working correctly on ArchLinux machine
I'm trying to use the signaling mechanism of UNIX to do some processing. To test out this functionality, I wrote the following code:
#include <stdio.h>
#include <signal.h>
#include <...
0
votes
0
answers
51
views
echo command throwing "Filename too long"
I have a really large data stored in a single Unix variable. it is a very very big JSON (approx 100k lines).
rules = '<BIG JSON>';
echo $rules > filename.txt
The second line throws an error ...
0
votes
0
answers
45
views
How can I create custom hex colors in Vimscript?
So I was trying to make a Vim colorscheme, but then I stumbled on a problem. There was this Vim colorscheme that was compatible for one terminal profile, but not on another. Here's the profile with ...
1
vote
3
answers
122
views
Understanding errno Codes: Need Assistance
I was looking at errno.h source code, to find how the variable errno is implemented, I was expected it to be int or something like that, but when I look into glibc errno.h file, I found this line:
/* ...
0
votes
1
answer
51
views
Linux command line utilities: Can sort(1) sort text by multiple (>2) columns? [closed]
I have the following data
foo-a12a11
foo-a12a2
foo-a12b12
foo-a12b21
foo-a13a10
foo-a13a1
foo-a13a9
IIII122344 # this indicates the order in which I want to consider the fields (I=ignore)
I want ...
3
votes
2
answers
62
views
How to catch cURL (piped through base64) download failure
I am using cURL to download files and store them in variables (via base64):
output=$(curl -L -o - $url | base64)
The problem is that I don't know how to check if the download was successful (if so, ...
2
votes
2
answers
102
views
how to use sed on a grep matched string and display the complete output
here is what I'm trying to do..
I'm trying to cat a text file and display the full file and only changing some characters (which are appearing in other lines also), and use grep to match the key words ...
1
vote
0
answers
61
views
Where/How to install a Qt Linux application so that it’s accessible to all users but runs with sudo privileges on startup [closed]
I'm developing a Qt application for Linux that overlays a watermark on all screens.
The application is intended for non-admin users, and I need to ensure that they cannot close it or modify its files, ...
0
votes
1
answer
60
views
fork vs vfork in process creation
As I know:
1- When calling vfork, parent waits until child is terminated (But when child invokes exec new address space will be made).
2- vfork does not use copy-on-write when creating child process. ...
0
votes
1
answer
137
views
fstream open hangs when opening named pipe for writing
My C++ code opens a named pipe and calls gzip ... & at the background, with system() to get the named pipe as input and output compressed text to a file. However, after that the program hangs when ...
0
votes
0
answers
74
views
Assign to variable file downloaded by cURL returns an error: ignored null byte in input
I try to download a file using cURL and assign it to a variable:
var=$(curl -s <urlToFile>)
it returns an error:
warning: command substitution: ignored null byte in input
I spend a lot time ...
6
votes
4
answers
152
views
How to cut ranges from end to start?
I need to change the order of a string in AIX, but with the command cut I can't do it
Ex:
echo FT0215202301.xml | cut -b 7-10,5-6,3-4
Result:
02152023
Expected:
20230215
1
vote
0
answers
30
views
Globs and variables as arguments to cd [duplicate]
I would like to run the following code in a script.
cd "build_dir/target*/$1*"
I would expect it to cd into the only directory that matches the pattern. Is there a way to do it in general?
...
0
votes
1
answer
28
views
Stack and process data segment (heap) allocation from OS VMM?
How is a process virtual address space size determined when a process starts on Unix systems? What happens between VAS, PAS, through VMM when the process data segment or stack must grow?
Looking at ...
0
votes
1
answer
37
views
Stack and heap size allocation question for common Unix OS
In Unix operating systems how are sizes between low and high address of the following picture chosen? I’m assuming this has something to do with Virtual Memory management and allocation of pages.
I’m ...
0
votes
1
answer
45
views
What should the address argument be for .bind() when using AF_UNIX and SOCK_SEQPACKET in Python?
I'm very new to all of this, but what is the argument or "bytes-like object" needed for .bind()? I read that "the address argument to .bind() and .connect() is the path of the Unix ...
0
votes
1
answer
68
views
How can I wait for a threading event and socket pollin at the same time?
I have a select.poll() object for incoming messages of a socket, and a queue.Queue() object that contains potential outgoing messages.
While both objects separately support waiting for a timeout ...
0
votes
0
answers
58
views
How to change ZIP version in Java with apache zip tool?
I'm trying to zip files in Java using apache.commons.compress.archivers.zip, it works fine but, i need my archive to be compressed with a specific zip version - 3.0, but no matter what i do, when i ...