Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [gnu]

GNU Project is a free software, mass collaboration project. The founding goal of the project was, in the words of its initial announcement, to develop "a sufficient body of free software [...] to get along without any software that is not free.

1
vote
3answers
79 views

grep everything up until and including a pattern

Let's assume I have a log file that contains exceptions as shown java.lang.NullPointerException blabla ABC.Exception blalabbla dogchacecat.Exception yadayada I want to be able to output each line ...
15
votes
5answers
671 views

Subtract time using date and bash

All the other questions on the SE network deal with scenarios where either the date is assumed to be now (Q) or where only a date is specified (Q). What I want to do is supply a date and time, and ...
2
votes
1answer
37 views

Add (true || … ) to a function using sed

I quickly want to patch a huge library by adding true || in front of every function call. Example input: if function_a(some_parameters) && function_b would turn into if (true || function_a(...
0
votes
2answers
49 views

How can sed replace in the range of nth line regex specified?

I am to replace using sed the 3th (or nth to be more general) occurrence in respective line with specified match regex. so far as i can is only to do the first: $cat file # Golden dictionary is a ...
6
votes
1answer
102 views

Any way to have a “verbose mode” or “debug mode” with sed?

Is there a way to make gnu sed be verbose about what is run and what is done ? I'd like to have something like a "debug mode" so that I can see - for each line of input - the content of the hold space ...
6
votes
7answers
554 views

How to avoid printing a newline when seq completes?

To create a column header, looking like: 1234567890123456789 I (am trying to) use seq and echo: seq -s '' 1 9 ; echo -n 0; seq -s '' 1 9 However, seq outputs a newline after each run. How can I ...
0
votes
0answers
33 views

Why doesn't Guile have /usr/local in path?

I've noticed when compiling and installing modules for Guile in /usr/local that they cannot be found, while setting the prefix to /usr they work as intended. Is there a reason why Guile doesn't have /...
1
vote
1answer
45 views

what used to lead /bin being full and creation of /usr/bin?

I am and was reading https://lwn.net/Articles/773342/ where the current move of migrating whole lot of filesystem from /usr/$something to simply /usr . Some of the comments again and again comment on ...
0
votes
2answers
60 views

Gnu Sed: Space Character class not matching for end of line character

Pattern: abc followed by space or is the last character in a line. orig="abc[[:space:]]+"; new=Hello sed -i -r -e "s|${orig}|${new}|g" ./file ; File: abc abcd abc abc d After executing: abc abcd ...
-1
votes
1answer
65 views

Bash Conditional String and Integer together

I am trying to do both integer and string comparison in a statement as follows: $ TimeHr=$(date +%_H) $ Time=Night $ echo TimeHr 1 $ if ((TimeHr>18 || TimeHr<5 )) && [ Time == "Night" ]...
1
vote
2answers
90 views

Awk or Sed: If pattern is found: delete line && export variable

In my bashscript I want Sed to find debug: Debug in a file ${SourceP} and if found delete that line and export to the environment Debug=Debug sed -i '/debug: Debug/,+0 d' ${SourceP} && export ...
1
vote
1answer
36 views

Why does `xargs -n ` on SmartOS (SunOS) behave differently than other implementations?

It seems the -n option on the xargs found in SmartOS (and I assume Solaris) does not behave like any other version of xargs I've encountered. Take this example: Builtin /usr/bin/xargs (odd behavoir):...
0
votes
1answer
30 views

Array inside an Array: Different syntax for Array in bash

I found the following example from here. But I can't understand how is array arr is being defined. a='domain.de;de;https' $ arr=(${a//;/ }) What is the advantage of defining it like this? Actually, ...
0
votes
1answer
53 views

What is the predefined order in which man searches sections? [duplicate]

The description of man in its own man page contains the statement, The default action is to search in all of the available sections following a pre-defined order ("1 n l 8 3 0 2 5 4 ...
1
vote
1answer
100 views

GNU coreutils and GNU Bash [closed]

I confused with GNU coreutils and GNU Bash, I have installed Bash GNU Project - Free Software Foundation, Should I install Coreutils - GNU core utilities How could I distinguish them?
0
votes
0answers
37 views

Update Reference to GNU/Bash manual in place on Macos

I installed GNU/bash on MacOs and set it as default: $ bash --version GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin18.0.0) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: ...
0
votes
0answers
117 views

My Debian install gives me black screen on start up - it's a quick fix but it happens every time

My issue is a bit strange. I am running Debian GNU/Linux Testing Buster, and I'm very happy with it. However, it has one minor but persistent issue that I can't seem to figure out. Each and every time ...
4
votes
2answers
456 views

Makefile and .ONESHELL

When .ONESHELL is not used Makefile executes each shell commands in a separate shell. What is the benefit of this? Why doesn't makefile uses the same shell?
0
votes
1answer
44 views

GNU coreutils need suggestions [closed]

Can anyone please suggest me some book or website from where I can learn about gnu coreutils to get more knowledge about terminal commands. An interactive book or website would be a nice start.
3
votes
2answers
633 views

The difference between find and GNU find

Consider some common *nix systems (say Debian, Ubuntu, Fedora, CentOS, Arch and Kali). I use Linux since 2014 but always used find. I don't recall personally using GNU find, but from one example I've ...
1
vote
2answers
70 views

Find a list of files that contains a set of consecutive lines defined in another file

I have a Reference file that contains a b c d I have to check all files in a subfolder recursively that contains all the lines of Reference file consecutively and delete those files. For example, ...
2
votes
0answers
64 views

Ulimit not respected in GNU bash OSX

I am seeing a strange issue with gnu bash in OSX. The value of ulimit -f is being changed by the bash itself. Small reproducible code: #!/usr/local/bin/bash ulimit -f 1 echo "Value: $(ulimit -f)" ...
0
votes
2answers
76 views

Sed with Character class [^[:space:]] not getting recognized

I used following sed with character class [^[:space:]] as follows: orig="(\`\`\`)([^[:space:]]*)"; new="\1{.\2 .numberLines startFrom=\"1\" .lineAnchors}"; sed -i -r -e "s|${orig}|${new}|g" ${...
0
votes
1answer
91 views

Makefile: Copy using make variables --> error; Not so without variables!

In the following makefile InputLocation:=./Test OutputLocation:=$(InputLocation)/Output Input:=$(wildcard $(InputLocation)/*.md) Output:=$(patsubst $(InputLocation)/%, $(OutputLocation)/%, $(Input:...
0
votes
1answer
26 views

Pass a Make variable to Bashscript that is invoked from inside Make

In a pattern rule I would like to export make variable like $(TargetLocation), $@. I tried the following but It didn't get exported. The bash script is executable. export $(TargetLocation); \ export ...
2
votes
3answers
82 views

Find command that excludes paths listed in a file

I need to exclude a bunch of paths from a find command. For example: find "$(pwd)" -not \( \ -path "*/.git"\ -o -path "*/.git/*"\ -o -path "*/.vscode"\ -o -path "*/.vscode/*"\ -o -path "*/...
0
votes
3answers
35 views

How to search for a match, then a non-match on that line, but include context lines for matched line?

Say I have a file containing: ⟫ cat schema.rb create_table "things", id: :serial, force: :cascade do |t| t.string "other_column" # ... t.datetime "created_at" end create_table "...
2
votes
2answers
237 views

Are there any successful forks or refactors of the Linux Kernel?

A google search reveals this slashdot story yielding this github repository that hasn't had a commit since 2016. There are 22,602 forks listed on github.com but these are going to be mostly (if not ...
0
votes
1answer
35 views

Can chmod on a directory without --recursive change who can read a file within that directory? [duplicate]

Based on the suggested duplicate, let me reformulate my question: If chmod 0660 path/to/folder is run, and user A isn't in the relevant group, could user A still read /path/to/folder/file.txt if that ...
1
vote
1answer
379 views

Why is ddrescue slow when it could be faster on error free areas?

This question addresses the first pass of ddrescue on the device to be rescued. I had to rescue a 1.5TB hard disk. The command I used is: # ddrescue /dev/sdc1 my-part-img my-part-map When the ...
-5
votes
2answers
120 views

Signal the end of option arguments: double dashes `--` vs single dash `-`? [duplicate]

I notice in https://unix.stackexchange.com/a/459007/674, that single dash - is used to signal the end of option arguments. Is it correct that double dashes -- can also signal the end of option ...
1
vote
1answer
119 views

Is sort -k1,2 equivalent to sort -k1,1 -k2,2?

I'm experimenting with GNU sort and LC_COLLATE="en_US.UTF-8". I have a file called 'test': 1,0 1 10 2 1,0 3 10 4 With sort -k1,2 as well as with simple sort test the order doesn't change: $ sort -...
0
votes
0answers
22 views

Changing a partition size without affecting the booting

I have Kali linux installed with dd on a couple of drives, they all have live persistence enabled with one acting as LUKS encrypted one (sdb3) (the one I'm using) and the other one is without ...
0
votes
2answers
61 views

Split file into 4 chunks using macOS version of split package

In GNU/Linux in order to split file into 4 equal chunks we can do something like: split temp -n 4 PREFIX_ But seems like the macOS' BSD version of split utility doesn't have -n option. What would be ...
0
votes
0answers
20 views

Prepend or append to substrings while expanding associative array in GNU Bash

This question was partly inspired by http://mywiki.wooledge.org/BashFAQ/073 , although that page is currently about indexed arrays rather than associative arrays. GNU Bash provides a syntax that ...
4
votes
1answer
112 views

Safely define an environment variable

AFAICT, neither GNU Bash, nor any other relevant package (e.g. GNU coreutils) that is commonly available in GNU/Linux distros, has a ready-made way to define an environment variable such that the ...
2
votes
1answer
82 views

Where is “gcc_tooldir”

Under Cross-Compiler-Specific Options, it says: The default value, in case --with-sysroot is not given an argument, is ${gcc_tooldir}/sys-root. but it appears that gcc_tooldir is not defined. Is ...
4
votes
3answers
842 views

How can I partially serialize with GNU make

When I have a make task where a specific target needs to be made before another, while in parallel mode, this is simple when using SunPro Make (dmake). The following makefile: install: dir dir/file ...
1
vote
1answer
270 views

GNU Pattern Match and replace exact number of characters

This question may have been listed but I was not able to find one exact hit. I am trying to skim through a file, match a pattern and replace it with something else. However there are other ...
3
votes
0answers
78 views

Why BSD grep is not returning all the results, but GNU does? [duplicate]

Given the file with numbers from 1 to 100 (seq 1 100 > dataset.txt), and the pattern file with numbers from 1 to 20 (seq 1 20 > patterns.txt), I would like to to print all exact matches from ...
0
votes
0answers
55 views

Solar time in gcal (GNU calendar)

How to display solar time (real time, sundial time) in gcal? gcal has option -c which displays fixed date events from ~/.gcalrc where you can use % macros. There are several astronomical macros ...
1
vote
0answers
7k views

GNU Samba server: check SMB version of exported and mounted shares

I have a NAS Zyxel NAS326 running on Linux acting as Samba server. I can't exactly say which Linux distribution, this is all I get from "uname -a": root@nas326:~# uname -a Linux nas326 3.10.39 #1 Fri ...
0
votes
2answers
53 views

What's $(MAKE) or ${MAKE} actually supposed to mean in make scripting language

What's $(MAKE) or ${MAKE} actually performing in entire make building process. is it invoking a process which is similar to sub-routine i.e. in simplest terms 'call a function', or is it starting a ...
5
votes
1answer
267 views

Problem using xargs --max-args --replace with default delimiter

This works as expected: $ echo a b c | xargs --replace="{}" echo x "{}" y x a b c y This does too: $ echo a b c | xargs --max-args=1 echo x x a x b x c But this doesn't work as expected: $ echo a ...
1
vote
1answer
249 views

Are Unix's extended regex compatible?

Are Unix's tool regex fully compatible ? For instance, if I grep -oE "\$text *\( *([^)]) *\)", am I garanteed to replace the exact portion I got if I use sed -E "s/\$text *\( *([^)]) *\)/replacement/...
1
vote
1answer
71 views

Does the search tracking and Amazon information sharing attributed to Ubuntu part of Debian?

I understand from Richard Stallman in this video, made probably in 2012/2013, that Ubuntu isn't 100% free by the GNU organization definition of Free Software, as according to Stallman there, it "spies"...
0
votes
1answer
253 views

A strange problem when trying to install GNU MPFR

I'm trying to install GNU MPFR. I've downloaded the source, cd'd into it and typed ./configure, which goes through a load of checks (which are all okay, as far as I can see.) The problem occurs when ...
3
votes
1answer
514 views

How do I prevent gpg from including SHA1?

apt-get is complaining that signatures are invalid and that the InRelease file is not signed (see Using Centos to sign .deb packages for background). On the server, I have verified using gpg that ...
-3
votes
2answers
105 views

Is tty like a OS without DE?

Can I use tty to call Media Player and watch a video? Or run a browser in it? Since tty is just a virtual terminal.
1
vote
1answer
127 views

Freebsd 11.1 issues with gnu m4 eval test fail

I am pretty new Freebsd user. As I am trying to install gnu m4-1.4.18, I get eval fail on eval test section: Checking ./189.eval @ ../doc/m4.texi:6405: Origin of test ./189.eval: stdout mismatch --- ...