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
0answers
26 views

Why aren't the argv and envp arguments to execve pointers to const? [migrated]

Take e.g. execve(2), which according to posix has this prototype [1]: int execve(const char *path, char *const argv[], char *const envp[]); To me, it seems as if int execve(const char *path, const ...
3
votes
2answers
34 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
39 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
39 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
43 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 ...
7
votes
0answers
134 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 ...
19
votes
1answer
288 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
167 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 ...
4
votes
1answer
118 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
256 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 ...
6
votes
3answers
276 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
189 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 ...
24
votes
7answers
1k 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
111 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 ...
17
votes
2answers
360 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
158 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
54 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
88 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
193 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 ...
9
votes
2answers
840 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
248 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”) ...
9
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 ...
4
votes
2answers
225 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
379 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
314 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
288 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
95 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
203 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
100 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 ...
2
votes
2answers
53 views

How can we obtain a temporary filename in a standard-conforming IEEE 1003.1 script?

How can we obtain a temporary file name in a standard-conforming shell script (using no commands or extensions which are not described the 2013 edition of IEEE 1003.1). There doesn't appear to be any ...
1
vote
1answer
158 views

Is the Linux implementation of the system configuration “variable” ARG_MAX different from other system variables and is it POSIX compliant?

In the shell, as explained in this this Q&A in the context of expansion, depending on the system, the maximum length of a command's argument is initially constrained by the kernel setup. The ...
1
vote
1answer
614 views

Reverse id command, I want the User/Group Name from the uid or gid

I know some uid and gids that I dont know who they belong to and they are not in /etc/passwd (could be LDAP or from another system). How do I get Id info from only uid or gid preferably without using ...
1
vote
2answers
34 views

Can I use `type` to check whether an arbitrary name is a valid command name?

The bash built-in type can be used for this purpose by checking its exit status: Exit Status: Returns success if all of the NAMEs are found; fails if any are not found. How portable is it? The ...
3
votes
1answer
71 views

Common flag designations and standards for shell scripts and functions

I have been adjusting to using GETOPT and GETOPTS in my shell scripts and custom functions to enable me to use the functions that I create more flexibly. After using a number of UNIX functions I have ...
2
votes
1answer
117 views

Are “mostly POSIX-compliant” systems still considered POSIX systems?

Irix and OS X are POSIX systems because they are fully-POSIX-compliant. However, operating systems like FreeBSD, Haiku, and GNU/Linux, for example, are "mostly-POSIX-compliant". Can people still ...
5
votes
2answers
92 views

Nested POSIX groups in Linux [duplicate]

If I want to add all of the members who belong to the supplemental group web_users to the apache group (as an additional supplemental group) can I just add web_users group to the apache group? Or do ...
8
votes
3answers
148 views

POSIX compliant way to work with a list of filenames possibly with whitespace

I have seen Bash scripting guides suggesting the use of array for working with filenames containing whitespace. DashAsBinSh however suggests that arrays are not portable so I am looking for a POSIX ...
4
votes
3answers
298 views

OS X/Linux one-liner/script to find the largest recurring group of lines in a text file?

I have a log containing an execution trace where there is infinite recursion eventually terminating when the stack is too deep. There are enough lines and valid included recursion within the larger ...
5
votes
4answers
116 views

Is it shell portable to run a command on the same line after variable assignment?

Is there any standard that covers the portability of running a command after variable assignment on the same line? APPLE="cider" echo hi How portable is something like that? Where will it work and ...
3
votes
2answers
967 views

Replace a pattern in a file with a long string

I'm writing a little shell script to generate a directory listing. To make the output easily customizable, the script just builds a HTML-table and than should replace a specific token in a template ...
22
votes
3answers
621 views

shellcheck is advising not to use basename: why?

I am trying out shellcheck. I have something like that basename "${OPENSSL}" and I get the following suggestion Use parameter expansion instead, such as ${var##*/}. From the practical point of ...
3
votes
2answers
130 views

Shell-independent way to cp dotfiles from a folder to another [duplicate]

I have two existing directories : foo: directory with dotfiles in it foo2: empty directory I would like to have a solution to copy all dotfiles in foo to foo2. I would like a solution that is not ...
28
votes
1answer
1k views

Does 'rm .*' ever delete the parent directory?

The expression .* is expanded by bash to include the current and parent directories: $ ls -la total 2600 drwxrwxrwx 2 terdon terdon 2162688 Sep 10 16:22 . drwxr-xr-x 142 terdon terdon 491520 Sep ...
2
votes
0answers
37 views

Is there a standard POSIX way of doing `tac` [duplicate]

Looks like at least IBM AIX and HP-UX don't have the tac command by default. Is there a way to do this using just basic posix standard shell utilities available on all UNIX systems? Furthermore, is ...
0
votes
1answer
39 views

Is there such a scheduler and is it feasible?

I read about a scheduling algorithm called EDD which always works on the next deadline and that is feasible. Would it also be feasible to within each time windows or slice, work on all processor or ...
3
votes
1answer
2k views

How does umask affect ACLs?

Can someone explain to me how umask affects the default mask of newly created files if ACLs are activated? Is there some documentation about this? Example: $ mkdir test_dir && cd test_dir $ ...
2
votes
1answer
151 views

How to negate a regex inside another regex

That is, given a POSIX regex X, what POSIX regex is the complementary of X? (in a more detailed way: how to get regex X' that matches all strings that are not matched by X, but doesn't match any ...
5
votes
2answers
995 views

POSIX find all local files

I'm trying to write a cross-platform command line that will find all local files on a file system. My intention is to use the find command, using only POSIX parameters. Is there a way to skip ...
2
votes
3answers
130 views

Why are POSIX Find Parameters Different from Other Program styles?

Why is a parameter in the POSIX find command added with a single hyphen for multi-character parameter names, while most other programs use single hyphen to indicate multiple single-character flags, ...