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

1
vote
3answers
24 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
29 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
17 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
30 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
89 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
27 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 attempty failed at trying or ...
4
votes
2answers
95 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
43 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
168 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
101 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
167 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
32 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 ...
5
votes
2answers
183 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
123 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
43 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 \ ...
1
vote
1answer
19 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
82 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
42 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 ...
4
votes
1answer
96 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 ...
8
votes
1answer
213 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
60 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
1answer
56 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
59 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 ...
4
votes
1answer
61 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
45 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
1answer
122 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 ...
3
votes
3answers
81 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
90 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 ...
2
votes
1answer
69 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 ...
1
vote
1answer
97 views

Will `mv` ever have the ability to create directories?

This question asks for the best way to create a directory when using mv if it doesn't exist. My question is why isn't this an inbuilt feature of mv? Is there some fundamental reason due to which this ...
1
vote
1answer
111 views

Multithreading in Mail server (Postfix)

I need to perform multithreading on postfix mail server. I read about POSIX multithreading but could it be linked to postfix smtp server and if yes then how? System Specification: ubuntu 14.04 LTS and ...
1
vote
1answer
80 views

What, as examples, can produce a POLLNVAL?

The reference about poll() just says “The specified fd value is invalid. This flag is only valid in the revents member; it shall ignored in the events member.”. That's not clear (at least to me): if ...
3
votes
0answers
64 views

find printf switch POSIX alternative

I'd like to rewrite these 2 command so they will use only POSIX-complaint switches: find "$TARGET_DIR" -maxdepth 1 -type d -printf '(DIR) %f\n' find "$TARGET_DIR" -maxdepth 1 -type f -printf '%s %f ...
1
vote
0answers
61 views

OS X Yosemite is SUS - Single Unix Specification 3 certified. But what posix standard is it compliant to? the latest one is 2008

I'm confused. Is SUS compliance the same as POSIX compliance? Is yosemite compliant to the latest standards, what years exactly?
10
votes
4answers
2k views

Use #!/bin/sh or #!/bin/bash for Ubuntu-OSX compatibility and ease of use & POSIX

I know that I can use either as the first line of scripts to invoke the desired shell. Would #!/bin/sh be recommended if compatibility with all unix systems is an absolute requirement? In my case ...
0
votes
0answers
44 views

POSIX description of cp -R

I just became really confused by the implementation of bash's cp -R command compared to how POSIX words what should happen Given the posix definition, I would expect cp -R srcDir existingDestDir to ...
5
votes
1answer
167 views

Why does 'find -exec cmd {} +' need to end in '{} +'?

Preface: I understand the difference between -exec {} \; & -exec {} +. I also don't have a problem as such, I am just curious about the semantics of find. When ending the -exec argument with + ...
1
vote
1answer
58 views

Is field splitting and filename expansion turn off in RHS of variable assignment portable?

In most POSIX compliant shell like bash. ksh, dash, mksh, pdksh, when variable assignment occur, field splitting and filename expansion (and brace expansion if the shell supports) are not performed in ...
-2
votes
1answer
207 views

Regular expression in unzip files argument not working

I'm trying to view the contents of a zip archive using an extremely simple regular expression. This works: rmorton@Rockette:~$ unzip -l Downloads/WeiDU-Linux-236.zip "*/i386/tolower" "*/i386/weidu" ...
35
votes
7answers
2k views

Is test or [ or [[ more portable both between bash shells and between other shells?

I see I can do $ [ -w /home/durrantm ] && echo "writable" writable or $ test -w /home/durrantm && echo "writable" writable or $ [[ -w /home/durrantm ]] && echo ...
1
vote
1answer
257 views

open() return new file descriptor posix [closed]

I have to set the return values for open() in posix. How do I return "the new file descriptor" as it is said in the Linux man pages: RETURN VALUE open(), openat(), and creat() return the new ...
2
votes
2answers
416 views

Is there a specific reason why iptables would return an exit code of 3 (instead of 1?) when executed without sufficient privileges?

I simply forgot to use sudo: usr@arch ~[0] $ iptables -L iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root) Perhaps iptables or your kernel needs to be ...
3
votes
2answers
58 views

How is it possible to execute a command with an unknown number of arguments in a POSIX shell?

I want to search for multiple words inside the current directory. To accomplish this I use something like this. grep -e "word1" -e "word2" -R . This works fine. Taking this one step further, I ...
2
votes
1answer
131 views

Single or double brackets and portability

I have found some very good answers here on the differences between [ and [[ in 'if' statements. For specific named shells, it seems to be a good idea to use [[ over [ (and it is faster, too). I'm ...
4
votes
1answer
755 views

Consequences of setting up POSIX locales

Small background of the situation: We are using several UBUNTU servers having English as working language; however having en_US locale set in machines we encounter problems with apt-cacher-ng ...
2
votes
1answer
128 views

Process IDs range

On GNU/Linux system I seen only positive PIDs, but when kernel panic occured I seen info about process with PID=0. What's it? On Minix 3 I seen processes with negative PIDs. Minix is POSIX-compatible ...
10
votes
1answer
318 views

regarding portable sed -e… d b or ! b?

In this edit Stéphane Chazelas POSIXifies (again) my sed formatting by inserting an -expression break and another -expression statement. Now, I might just ask him why in the comments, I suppose, but ...
25
votes
1answer
1k views

When and how was the double-dash (--) introduced as an end of options delimiter in Unix/Linux?

I don't think the shell/utilities in historical Unix nor in something as "recent" as 4.4BSD supported using a double-dash(or two consecutive hyphens) as an end of options delimiter. With FreeBSD, you ...
3
votes
3answers
264 views

Interactive command usage reference: do you generally have that on Unix?

The question of why some commands rely on manpages whereas others rely on something like the --help flag for providing command usage reference is not new. There is usually a difference in scope ...