Questions tagged [posix]
POSIX is an acronym for Portable Operating System Interface, a family of standards specified by the IEEE for maintaining compatibility between operating systems.
717 questions
8
votes
1
answer
98
views
POSIX: Regular Expression: "\(a\(b\)*\)*\2" matches "abab"
According to chapter 9. Regular Expressions, subchapter 9.3.6 BREs Matching Multiple Characters, number "3.": "... the expression "\(a\(b\)*\)*\2" fails to match 'abab' ...&...
2
votes
1
answer
59
views
why cant pgid (process group leader)cant change its pgid?
Why is it that a Process Group Leader can't change its PGID? I know it sounds dumb for a leader to just abandon its own group, but what is the actual architectural reason behind this? What would ...
3
votes
1
answer
169
views
Explanation about difference in error handling in sub-shells between bash and posix-sh
I have the following code:
set -e
log=$( false ; true )
echo "success(?)"
It exits with error code 1 when run via sh (as expected), but succeeds with bash.
I figured (and read) that bash ...
0
votes
1
answer
179
views
In a shell script, why use multiple `printf` or `echo` expressions instead of a multiline string literal or HERE document? [closed]
For example, from OpenSSH:
echo "usage: ${PROGNAME} [OPTION]..."
echo
echo "This script creates an OpenSSH user configuration."
echo
echo "Options:"
echo " --...
5
votes
2
answers
649
views
How to portably map an error number in errno to the symbolic error name?
On a Debian system, man 3 errno tells that the code names (ENOENT) are portable, but the integers in errno are not. If an error is reported, the name instead of the integer number is therefore the ...
3
votes
1
answer
174
views
Handling of Single Quotes inside a Here-Document
According to the Shell Command Language Specification: "2.7.4 Here-Document":
Any <backslash> characters in the input shall behave as the <backslash> inside double-quotes (see 2....
0
votes
2
answers
108
views
Shouldn't 'chmod + file' be an error?
Why isn't
$ chmod + .profile
an error?
Shouldn't the user have added some extra character to make the command do something?
10
votes
2
answers
1k
views
How to portably find file modified less than 10 minutes ago
Context: I want to process a file created by another program, but the name of its output file is not completely under my control, so to find its output I use find to find all files in the output ...
0
votes
2
answers
114
views
How can I read a single key press from a user if it's either the Escape key or a function key?
I'm writing a shell script that's aimed to be as portable and POSIX-compatible as possible, so usage of bash-only commands or high-level input libraries is undesirable.
I'm looking for a way to read a ...
5
votes
4
answers
476
views
awk not flipping columns properly, alway 1st column preceeds
I have the following file below,
$ cat voltages.txt
"-0.20"
"-0.10"
"-0.00"
"-0.10"
"-0.20"
"-0.30"
"-0.40"
"-0.50"
&...
1
vote
1
answer
77
views
Abort on command substitution error in argument [duplicate]
How can I prevent command substitution in arguments from silently swallowing errors?
#!/bin/sh
set -e
echo "Evaluating $(false) should abort."
echo "This line should not be executed.&...
5
votes
3
answers
1k
views
POSIX sh alternative for bash's regexp matching
I am using this code to parse the first argument passed to my script. It error handles and it works just the way I want it:
if [ -z "$action" ]; then
printf "[${c_RED}ERROR${c_RESET}...
0
votes
1
answer
114
views
Do posix functions like getpeername or getsockname completely rewrite their buffers?
I am new to socket programming & I have realized that most posix functions from libc require that you pass a buffer & a length. While I can understand this helps the functions to understand ...
6
votes
3
answers
492
views
Help w/ "posix-extended" regex for 'find'
Can someone explain the issue I've described below, and perhaps suggest a resolution?
I'm trying to process a set of filenames using find. My platform is macOS (Ventura 13.7.7), and the shell is zsh ...
0
votes
0
answers
31
views
Posix filesystem features overlay [duplicate]
I have a remote system where I can create only files and directories. No symlinks, ACLs, hard links, devices, nothing.
I think, it would be really useful to be able to use it even as a linux root ...