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

2
votes
1answer
101 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
66 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 ...
2
votes
1answer
286 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
202 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
167 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
181 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
740 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 alternatively also 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 ...
4
votes
1answer
357 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), ...
1
vote
0answers
22 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
49 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
38 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
58 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
72 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
53 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
53 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
48 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
47 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
573 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
108 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
263 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
89 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 handler....
1
vote
1answer
53 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
133 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?
2
votes
0answers
310 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 ...
6
votes
2answers
252 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
96 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
279 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
62 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
233 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 ...
-1
votes
3answers
297 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
319 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
97 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 ...
7
votes
2answers
423 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
158 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
136 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
67 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 ...
34
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
707 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 #!/bin/...
0
votes
0answers
190 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 "/usr/bin/...
5
votes
1answer
174 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 non-...
9
votes
1answer
500 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 ...
0
votes
2answers
148 views

Grep for regex in basename but return wholename

So say I have a list of files in a text file: ... /foo/barfoo /bar/foo/foobar /foobar/bar/foo ... I have a script that will search through this text file and, much like the locate command, I want ...
4
votes
2answers
352 views

Posix command that moves cursor to specific position in terminal window

in school we have been assigned a homework in which we are suppose to print an ascii art into a terminal window. A input is data in format [x_coordinate, y_coordinate, char_ascii_value] (there is no ...
2
votes
1answer
98 views

POSIX shell scripting and performance tuning [closed]

Nowadays, I'm researching for performance tuning for shell scripting , And I have been prevented to POSIX shell scripting, However it's only a standard, But I think it's rathar than standard for do it....
5
votes
1answer
101 views

What are the 'n', 'l', '3pm' sections of the manual for?

An excerpt from the man man page: The default action is to search in all of the available sections following a pre-defined order ("1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7" by default) What are ...
1
vote
1answer
128 views

Reading input fields separated by spaces

How can I read in POSIX bash input like this: <name>,<tag1> <tag2> <tag3>… I tried while read line;do done but this wants newlines, all I have is spaces. (Is IFS solution? ...
2
votes
2answers
376 views

uname -n vs hostname

What is the difference between uname -n and hostname? Are there any real differences in what they return? Are there any differences in availability on different OSes? Is one of them included in POSIX ...
4
votes
3answers
409 views

When to use XPG* version of a command?

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support ...
2
votes
1answer
213 views

I have a multi-line string that I need to iterate over, but I'm not using bash. Advice?

I'm using Dash because this is to run on my rPi. Bash is not an option. I'm rewriting a Bash script to work with Dash. I'm hoping to make it as POSIX-compliant (portable) as possible. The thing is it'...
2
votes
1answer
170 views

Order between options and operands?

When using a utility program, we may specify options (and their option arguments) and/or operands. In most cases (in the sense of conforming to some standard (POSIX?)) does the order between ...