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
1answer
44 views

POSIX shell scripting and performance tuning [on hold]

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
53 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
30 views

read reading input devided 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? ...
0
votes
0answers
15 views

Any GNU C examples where faccessat() function (or equivalent) is used? [migrated]

In reading IEEE Std 1003.1 (POSIX Base Spec) regarding access(), I came across this note: "The purpose of the faccessat( ) function is to enable the checking of the accessibility of files in ...
2
votes
1answer
40 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
52 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
35 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
43 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
91 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
52 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
40 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
50 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
47 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?
9
votes
4answers
1k 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
40 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
149 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 + ...
0
votes
1answer
30 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
116 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" ...
32
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
146 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
272 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
48 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
87 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 ...
3
votes
1answer
529 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
87 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 ...
8
votes
1answer
292 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 ...
23
votes
1answer
844 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
234 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 ...
6
votes
1answer
199 views

Does Posix require any devices?

Does Posix require any devices? For example, /dev/urandom, /dev/zero or /dev/null? I suspect not because of non-*nix OSes, but wanted to ask for completeness.
2
votes
1answer
697 views

Removing non-printable characters using POSIX sed

Files created with roff and other "old-school" tools (for example man pages on many Unix systems) generate bold and underlined text in minimalistic terminals using tricks involving non-printable ASCII ...
7
votes
3answers
379 views

`/proc/$PID/cwd` : is there a POSIX equivalent?

Linux has a /proc directory and file‑system, which as far as I can tell, is not part of POSIX. In each /proc/$PID subdirectories, is a symbolic link, cwd, pointing to the actual working directory of ...
2
votes
1answer
2k views

How do I use grep to find a text string in files in sub folders of a parent folder without -r switch

I'm using Solaris 10 and have two grep versions one in /usr/bin and one in /usr/xpg4/bin. I have been searching for an answer on how to search for text within files within sub folders of a parent ...
25
votes
7answers
2k views

What's the difference of the Userland vs the Kernel?

I am trying to understand exactly what is userland? everyone that I ask says: "Anything that is not kernel". but it is not tangible for me. When I am reading that kernel can run that driver on the ...
3
votes
4answers
197 views

Protected environment variables?

Are there names of environment variables that cannot be overwritten by the user/a call to setenv? As I understand from POSIX1.2008, any process may edit the environment block, but must avoid ...
18
votes
2answers
511 views

explanation on chown(1) POSIX spec

The POSIX spec for the chown utility mentions in its rationale section about the chown user:group syntax (formerly chown user.group) (emphasis mine): The 4.3 BSD method of specifying both owner ...
5
votes
2answers
260 views

How exactly does `if $cmd ; then $cmd ; fi` differ from `$cmd && $cmd`?

In an answer to another very good question I made the following assertion: According to my reading of the POSIX specs, the use of one or the other makes no difference from a parsing standpoint. ...
1
vote
1answer
98 views

bash completion on posix mode

I would like to use an interactive posix bash shell but the autocompletion feature doesn't work. When i type the tab character it simply prints a tab. The tab completion only works when i'm on a non ...
0
votes
1answer
320 views

bash completion on posix mode [duplicate]

I would like to use an interactive posix bash shell but the autocompletion feature doesn't work. When i type the tab character it simply prints a tab. The tab completion only works when i'm on a non ...
5
votes
1answer
216 views

Where is $_ defined by POSIX?

In the comments to the accepted answer to this Unix & Linux StackExchange question, it is stated that $_ is "one of only some 7 special parameters defined by POSIX". I can't find that definition ...
10
votes
2answers
1k views

Is it OK to use “.” to run files instead of source - in .bashrc in Ubuntu and OS X?

OK, so source runs the script in the current shell and . separately, as detailed in running script with ". " and with "source " for example, but, specifically, in my .bashrc file, ...
2
votes
2answers
369 views

Is the double dash still the posix standard for long switches?

I've read several question about double dash: Single dashes - for single-character options, but double dashes -- for words? What does -- (double-dash) mean? (also known as “bare double dash”) ...
11
votes
5answers
1k views

What is meant by “a system call” if not the implementation in the programing language?

I would like to understand the term "system call". I am familiar that system calls are used to get kernel services from a userspace application. The part i need clarification with is the difference ...
5
votes
2answers
324 views

Which is the most portable of sed, awk, perl and sh?

Can someone put these tools in order of portability? Which of these is certain to be found on even the most minimal *nix systems? Is any of them 100% sure to be present? My guess is that the order is ...
5
votes
3answers
410 views

Are there “esoteric” (weird) but standards-compliant C compilers or runtimes?

As we know, the C standard does not specify a lot of details of the implementation, for example value of NULL pointer, order of bits and bytes (endiannes), alignment in structs and of stack ...
22
votes
4answers
1k views

Is the shell permitted to optimize out useless terminating commands?

If a shell is asked to perform a probably useless (or partially useless) command known to terminate, such as cat hugeregularfile.txt > /dev/null, can it skip that command's execution (or execute a ...
1
vote
1answer
358 views

Plain vi (not vim): Can't delete a line in insert mode: Is this behavior required by POSIX?

In the non-vim implementations of vi I've worked with, it's not possible to delete a line while in insert mode. vim does allows it—but it's my understanding that vim is not POSIX-compliant in ...
2
votes
1answer
556 views

Awk regular expression syntax with number of repetition - different handling between gawk 3 and gawk 4

I am having trouble understanding or explaining why the following expression fails in gawk 3.1.x and yet works in gawk 4.1.x: (Minimum working example) echo ";#ADCDE#" | awk '/#.{5}#$/' -> produces ...
0
votes
2answers
151 views

What does the `set $variable` do?

I know that set is used to manipulate environment variables, but I want to make myself sure - these alterations are not permanent, right? I mean once I close shell and reopen it, no changes will be ...
3
votes
1answer
317 views

Using shell's read command with live editing functionality (readline like)

Is there a standard (POSIX) way of asking the user some data from within a shell script, with read for example, while allowing live edition of the text being typed (what readline does)? I know bash ...
2
votes
1answer
227 views

indirect variable expansion in POSIX as done in bash? [closed]

Is it possible, or is there some elegant hack to do indirect variable expansion in POSIX as can be done in Bash? For context, I'm trying to do the following: for key in ${!map_*} do # do ...