All Questions
21 questions
0
votes
0
answers
78
views
To copy using cp non-recursively if the '-a' option is already used
BSD cp:
-a Archive mode. Same as -RpP options. Preserves structure and
attributes of files but not directory structure.
-P No symbolic links are followed. This is the ...
0
votes
0
answers
94
views
Trailing slash in GNU and BSD cp and find commands [duplicate]
What might be a reason that BSD cp and find don't "like" a trailing slash for directory names?
| | cp | mv |
|-----|--------------------------|...
6
votes
0
answers
10k
views
What's the equivalent to objcopy on macOS?
I would expect llvm-objcopy to be installed on macOS, since its counterpart llvm-objdump is installed toghether with other LLVM tools like clang.
What is the llvm-objcopy-equivalent tool to use on ...
0
votes
1
answer
935
views
how to make my sed command work in GNU works in BSD
I have a block content in my ~/.ssh/config. begin with a line '# BEGIN AUTO GENERATED CONTENT' and end with a line '# END AUTO GENERATED CONTENT'
I have a command replacing content between this two ...
7
votes
1
answer
2k
views
Newlines in BSD sed vs gsed
The sed, which comes with FreeBSD 11.2 p7, gives:
$ seq 10 | sed 'N; l; D; p'
1$
2$
2$
3$
3$
4$
4$
5$
5$
6$
6$
7$
7$
8$
8$
9$
9$
10$
While gsed (GNU sed 4.7) gives for the same script:
$ seq 10 | ...
-1
votes
2
answers
361
views
Are there multiple flavors of the GNU tools?
I think that the BSD tools have different flavors, for example the BSD ls tool is not the same tool on FreeBSD and OpenBSD and NetBSD (and even on macOS).
Note that by "different flavors" I mean that ...
2
votes
1
answer
959
views
Does Apple modify the GNU and BSD tools that comes with macOS? [duplicate]
macOS comes with bash (which is a GNU tool), macOS also comes with tools like ls and chmod (which are BSD tools, even though I don't know from which BSD flavor they come from).
Now does the GNU and ...
1
vote
0
answers
63
views
macOS (BSD) vs GNU grep multiple pattern inconsistency [duplicate]
I am on macOS Sierra 10.12.6
$ grep --version
grep (BSD grep) 2.5.1-FreeBSD
$ ggrep --version
ggrep (GNU grep) 3.1
Packaged by Homebrew
Copyright (C) 2017 Free Software Foundation, Inc.
License ...
1
vote
1
answer
717
views
bsdtar: How to avoid overwriting existing file info?
bsdtar has a -k (Do not overwrite existing files) option, which avoids changing the contents of any existing files, but it still overwrites the file info (e.g. permissions) with what is in the archive....
3
votes
1
answer
2k
views
With bsdtar "--exclude", how to only exclude subdirectories?
In GNU tar (i.e. gtar), the --exclude option with a glob only matches the subdirectories, but not the directory itself. For example, --exclude test-tar/a/b/* would exclude anything inside of b, but ...
2
votes
1
answer
462
views
How to make appends to files fail if the file does not exist already?
For example
echo Something >> SomeFile
I want this append to work only if SomeFile exists already.
Right now I am using the following:
if [ -e SomeFile ]; then
echo Something >> ...
12
votes
2
answers
13k
views
BSD sed vs. GNU sed, and -i
Unix iMac shell terminal
sed -i 's/original/new/g' maths.tx
Message returned: sed: -i may not be used with stdin
3
votes
3
answers
831
views
Using sed command arguments to be compatible with both GNU & BSD Unix (in-place editing)
I have a shell script that I currently use for some build related stuff for a mobile application.
Due to the the subtle differences between BSD & GNU one of build scripts originally written on a ...
8
votes
2
answers
1k
views
Are there standard versions of `sed` on which `-E` is unsupported?
On BSD sed, -E is the "extended regex" flag. On GNU sed, the documentation states that -r is the extended regex flag, but the -E switch works as well (though undocumented in my research).
I recall ...
1
vote
0
answers
67
views
How can I easily deal with differences between BSD and GNU sed? [duplicate]
BSD and GNU sed have some small differences in what arguments they accept. I just learned that I have to use different command lines when using -i:
sed -i '' # BSD
sed -i # GNU
I solved this with ...