POSIX is an acronym for "Portable Operating System Interface", a family of standards specified by the IEEE for maintaining compatibility between operating systems.

learn more… | top users | synonyms

0
votes
0answers
20 views

`getaddrinfo`: what specifies its data source in the POSIX standard?

I wanted to check getaddrinfo is expected to use Unbound when it's installed. Unless I overlooked something in this specification, it does not refer to any data sources it is required to check: ex. no ...
-4
votes
1answer
36 views

Simple bash script to print prime numbers from 1 to 1000 [on hold]

How can I make a POSIX script that will print all the prime numbers from 1 to 1000? Lots of thanks
1
vote
2answers
25 views

Should the operands to a utility always appear after all the options to the utility?

POSIX says utility_name[-a][-b][-c option_argument] [-d|-e][-f[option_argument]][operand...] ... The arguments following the last options and option-arguments are named "operands". ...
4
votes
3answers
61 views

Force POSIX mode

Brace Expansion, eg {a,b,c} is not defined by POSIX. I would like to run my shell in POSIX mode. With Debian this is simple enough: $ bash -c 'echo {a,b,c}' a b c $ sh -c 'echo {a,b,c}' {a,b,c} ...
1
vote
0answers
16 views

Why are there no LSM hooks in the POSIX IPC APIs?

As I understand it, the Linux Security Module (LSM) framework has many hooks which are callbacks for security modules to register functions performing additional security checks before ...
3
votes
7answers
321 views

Check if shell variable contains an absolute path

I want to check if a shell variable contains an absolute path. I don't care if the path exists or not—if it doesn't I'm going to create it—but I do want to ensure that I'm dealing with an absolute ...
0
votes
2answers
255 views

How to install php7 modules in archlinux?

I have the following php version installed: PHP 7.0.2 (cli) (built: Jan 6 2016 11:50:59) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies ...
3
votes
2answers
43 views

Parameter expansion on multiple variables

Parameter expansion on a single variable works as expected. But how to expand parameters that comprise several variables? Example: #!/bin/sh foo=/lorem/ipsum; bar=dolor/sit tmp="$foo/$bar" printf ...
8
votes
2answers
57 views

What does [[.ch.]] mean in a regex?

Alternate title: What is a "collating sequence" or "collating element" in a POSIX-compliant regex? I found the exact technical definition in Section 9.3.5 of the POSIX specs, as item #4 in the list, ...
2
votes
1answer
96 views

Why POSIX left `$(expression)` in awk unspecified?

Answering this question, I found that in: echo 1 2 | awk '{print $(expression)}' the return value of expression is unspecified. It can lead to confusion, as if expression is an uninitialized ...
3
votes
1answer
41 views

`EINTR`: is there a rationale behind it?

Small talk as background EINTR is the error which so-called interruptible system calls may return. If a signal occurs while a system call is running, that signal is not ignored and a signal handler ...
1
vote
1answer
56 views

Get output of `posix_spawn`

So I can run a process in Unix / Linux using POSIX, but is there some way I can store / redirect both the STDOUT and STDERR of the process to a file? The spawn.h header contains a deceleration of ...
4
votes
1answer
118 views

In POSIX sed, does the period (dot) match a newline in a multiline pattern space?

In GNU sed it works. For example, this matches two blank lines in a multiline pattern space (created with N) /^\n$/ Is this standard?
8
votes
2answers
142 views

Variable assignments affect present running shell

While writing some code I found out that this line: $ TZ="America/Los_Angeles" date; echo "$TZ" Thu Dec 24 14:39:15 PST 2015 Correctly gives the actual time at "Los Angeles" and that the ...
5
votes
1answer
175 views

Does POSIX sh allow empty compound-list in first condition and empty condition in case conditional construct?

Reading POSIX specification for case conditional construct, I see: case word in [(]pattern1) compound-list;; [[(]pattern[ | pattern] ... ) compound-list;;] ... [[(]pattern[ | pattern] ... ...
10
votes
2answers
709 views

Is there a POSIX way of setting zeroth argument of a target application?

In bash you can use exec -a and in zsh you can alterntavely set ARGV0 to execute a program with a certain zeroth argument but is there also a POSIX way of doing so? As suggested in this one comment ...
4
votes
1answer
282 views

Why GNU find -execdir command behave differently than BSD find?

On my OSX, I've installed GNU find next to default BSD find via: brew install findutils. As far as I understand, BSD find is following POSIX standards and GNU makes it optional (as per this post), ...
0
votes
0answers
19 views

The SUS v4 would not be able to certify Bell Labs unix v8 because unix has changed right?

I am not an an expert, so I would appreciate it if someone would clarify to me about how UNIX v8 from Bell Labs might not be able to certify with the Single Unix Specification v4 because UNIX has ...
2
votes
2answers
45 views

alphabetical expansion order for *

When I'm using a POSIX compliant shell (es: dash, bash, zsh, ...) can I be sure that * will always expand in alphabetical order (dictated by LC_COLLATE)? example: $ echo 1 > file_a $ echo 2 > ...
2
votes
2answers
34 views

How can I get FreeBSD `patch` to tolerate null bytes?

The patch of the final line fails on FreeBSD 10.2, but works on GNU: #!/bin/sh echo a > f1 printf '\0' >> f1 echo c >> f1 cp f1 f2 echo d >> f2 diff -au f1 f2 > diff patch ...
1
vote
0answers
40 views

When using linux acl mkdir and mkdir -p do different things

I have a directory bar: # file: bar/ # owner: root # group: root user::rwx user:little-jonny:rwx group::r-x mask::rwx other::r-x default:user::rwx default:user:little-jonny:rwx default:group::r-x ...
4
votes
1answer
66 views

Is this tail behavior in Grouping Commands specified by POSIX?

Using tail combined with other standard tools in Grouping Commands can make some powerful constructions. For example, to get the first and last line of a file: $ seq 10 > file $ { head -n1; tail ...
2
votes
1answer
48 views

Why does cd-ing to // set PWD to //, but more slashes just gives /? [duplicate]

On my ubuntu box I accidentally just did cd // and noticed that my current path changed to //. ls showed the contents of my root directory. When I try cd /// (or any other number of slashes) I'm just ...
1
vote
1answer
29 views

Is it safe to ignore O_DIRECT?

I am going to implement a filesystem in FUSE, and later in the kernel. I am not sure what to make out of Direct IO. Different sources emphasize on different things that this flag supposedly implies. ...
-2
votes
1answer
36 views

What is posix, and how can I elevate my permissions using python? [closed]

I was wondering if I could elevate my permissions on a chromebook with the os posix using a python script. I was not given the administrative permissions when I was given the laptop for college.
2
votes
2answers
36 views

What are the POSIX “mandatory utilities”?

For some reason, when it comes to POSIX, I always have a hard time finding the full scoop. For example, the POSIX docs (here and here) refer to "mandatory utilities", but I can't find any listing of ...
7
votes
4answers
563 views

Looking for POSIX utility to test whether filename is a symlink

I know that some shells at least support file test operators that detect when a filename names a symlink. Is there a POSIX utility1 that provides the same functionality? 1 I may not be using the ...
1
vote
2answers
69 views

Change time format in a file

I have output of a sar commands and the time is not POSIX: Linux 2.6.32-431.29.2.el6.x86_64 (test.server.com) 2015-08-01 _x86_64_ (32 CPU) 12:00:01 AM CPU %usr %nice %sys ...
10
votes
2answers
228 views

How to open grep(1p) manpage?

At the end of man grep, it says SEE ALSO\ POSIX Programmer's Manual Page grep(1p). I am not able to open the manpage grep(1p). How do I do that? Search net, Unix.SE and did trial and ...
1
vote
3answers
67 views

New signal arrives while execution is in a signal handler, how to decide which is first?

I am working on a tool handling a massive amount of signals (with different signums) with sigaction(). I need to handle the case, if a new signal is coming, while the previous was in a signal ...
1
vote
1answer
46 views

How reliable/portable are Nix built-ins/commands (echo, ps, sort, uniq) from Debian to other distros

I've coded a script and am wondering about it's reliability / portability. #!/bin/bash threadsPlease() { ps -mo lwp,c -p $1 | sort -gk 2 | uniq -f 1 } THREAD_LINE=$( threadsPlease $1 | grep -v - ...
0
votes
1answer
83 views

Linux UART IO File

How bytes received on UART device are stored in some serial Linux devices /dev/ttyS? How to read them? What is the procedure? Should that device file be closed, when new data is arriving?
1
vote
0answers
174 views

What happens to a multithreaded Linux process if it gets a signal?

If a Unix (Posix) process receives a signal, a signal handler will run. What will happen to it in a multithreaded process? Which thread receives the signal? On my opinion, the signal API should be ...
5
votes
2answers
149 views

Why do Linux/POSIX have lchown but no lchmod?

It seems that Linux supports changing the owner of a symbolic link (i.e. lchown) but changing the mode/permission of a symbolic link (i.e. lchmod) is not supported. As far as I can see this is in ...
2
votes
1answer
73 views

How to combine POSIX character classes of a regex?

I need to combine different character classes in a regular expresion used by sed. I need to match [:word:] and the minus symbol -. How does that look like? All my attempts failed at trying or ...
4
votes
1answer
179 views

POSIX behavior of sed's ^ and $ regex anchors with multiline pattern spaces

What is the POSIX behavior of the sed ^ and $ anchors when used at the beginning and end of a regex if the pattern space contains embedded newlines, like after you use the N command? Should they ...
5
votes
2answers
58 views

posix placement of stdin redirection (<in cmd vs cmd <in)

I always write stdin redirection after the command, because for me it's more natural to have first the command and then the redirections (if any): some-command < input-file > output-file For ...
4
votes
1answer
215 views

awk/nawk alternative on SunOs and Linux

I have a script that basically checks the Java version on the box it's running on and does whatever based on the version number. My problem is that I want to use the same command on both SunOs and ...
-2
votes
3answers
193 views

Why isn't there a Unix API?

Why isn't there the Unix API? I mean, as there is the Windows API. I know a lot of things in the Unix world is modular, and those things put together creates a whole system. This sounds good but does ...
4
votes
1answer
235 views

Any problem assigning one variable to another in shell without using quotes? [duplicate]

This question is about assigning the entire contents of one variable to another variable. Variable is not being used (sent to echo, etc.) No parameter expansion is being done during the assignment. ...
1
vote
1answer
61 views

Threads vs interrupts

What does it mean when threads are time-sliced? Does that mean they work as interrupts, don't exit while routine is not finished? Or it executes one instruction from one thread then one instruction ...
6
votes
2answers
285 views

How to send all output to `logger` in POSIX shell?

I'd like to log standard output and standard error separately in .xprofile using logger. In Bash I think that would look something like this: exec 1> >(logger --priority user.notice --tag ...
2
votes
1answer
147 views

fgrep or grep -F, which one is better for portable script? [closed]

I am having this controversial commentary on this answer to a quesion whether we should use fgrep or grep with the -F switch (i.e grep -F) for portability. The points that have been came into light so ...
1
vote
1answer
119 views

Compiling Python 2.7.10 Error

I want to add Python 2.7 to my Unix. I downloaded the sources to the VirtualBox on which the Unix is installed and run ./configure --prefix=/usr \ --enable-shared \ ...
2
votes
1answer
42 views

ipcs(1) POSIX equivalent to System V

I know that with ipcs(1) command, one can monitor System V message queues, shared memory and semaphores, but how do I monitor POSIX message queues, shared memory and semaphores. For POSIX message ...
33
votes
4answers
4k views

Why are UNIX/POSIX system call namings so illegible?

What is the reason to use such untelling system call names like time and creat instead of getCurrentTimeSecs and createFile or, maybe more suitable on Unix get_current_time_secs and create_file. Which ...
0
votes
1answer
399 views

/bin/sh script error “arithmetic expression: expecting primary: ” + “ ”

ERROR: ./client-disconnect.sh: 22: ./client-disconnect.sh: arithmetic expression: expecting primary: " + " I just need to know how to fix it. It's for user accounting with OpenVPN. Script ...
0
votes
0answers
142 views

Getting CRC mismatch warnings in gdb on cygwin

When I run any program under gdb in cygwin shell I get following warnings... warning: the debug information found in "/usr/lib/debug//usr/bin/cyggcc_s-seh-1.dll.dbg" does not match ...
5
votes
1answer
137 views

Is there a command line tool to manage unix signals?

Is there a command runner like env, nice, nohup, etc., that can run a program with modified signals? In my case, I need something to reset SIGINT to SIG_DFL. Why do I need this? Because ...
9
votes
1answer
315 views

What is the point of using multiple exclamation marks in sed?

POSIX sed documentation said: A function can be preceded by one or more '!' characters, in which case the function shall be applied if the addresses do not select the pattern space. Zero or ...