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

8
votes
4answers
731 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
120 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 ...
4
votes
3answers
349 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 ...
21
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
94 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
61 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
50 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
104 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
57 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
46 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
54 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
71 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
31 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
52 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
68 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
56 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
98 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
258 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 ...
2
votes
3answers
80 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
311 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
501 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 ...
0
votes
0answers
34 views

Rvm posix error on arm Beagle bone black

I'm trying to run rvm on Angstrom linux on BBB. When I try to launch rvm, I obtain: RVM can not be run with `set -o posix`, please turn it off and try again. Someone know about this?
3
votes
2answers
100 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 ...
23
votes
1answer
894 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
38 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 ...
2
votes
1answer
903 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
99 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
462 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
101 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, ...
4
votes
3answers
367 views

Should a serious student of *nix choose a distribution that is POSIX-compliant to learn standard features well?

I want to learn Unix or Linux as a serious student, and specifically want to learn the basics well so that I can have proper understanding and so I can move between platforms and distributions without ...
1
vote
1answer
125 views

POSIX head and tail not feature equivalent

The documentation for POSIX tail's -n option says that The origin for counting shall be 1; that is, -n +1 represents the first line of the file, -n -1 the last. So tail -n 10 (used later on the ...
3
votes
2answers
175 views

How to monitor the last PID assigned by the kernel?

To monitor process creation I'd like to periodically write the last PID assigned by the kernel to any process on the system (not just processes created by the PID-monitoring program) with a time stamp ...
2
votes
1answer
493 views

Why is brk(0) called?

On a first shell I run the command tail with no argument. On a second shell I kill the first tail using strace to monitor the system calls. qdii@nomada ~ $ strace kill 1713 execve("/bin/kill", ...
19
votes
4answers
921 views

difference between function foo() {} and foo() {}

I can define bash functions using or omitting the function keyword. Is there any difference? #!/bin/bash function foo() { echo "foo" } bar() { echo "bar" } foo bar Both calls to functions ...
1
vote
2answers
2k views

linux command to check POSIX message queue

We can check the details of system V message queue with the help of ipcscommand. Is there any command to check POSIX message queue in Linux?
3
votes
1answer
816 views

Obtain device name and mount point if partition label is known

How to obtain the partition device name and mount point when the file system label is known? There are several possibilities: Linux File system label to device name The device name can be obtained ...
4
votes
2answers
287 views

What would break if the C locale was UTF-8 instead of ASCII?

The C locale is defined to use the ASCII charset and POSIX does not provide a way to use a charset without changing the locale as well. What would happen if the encoding of C were switched to UTF-8 ...
5
votes
1answer
36 views

IO and other shell commands when a program is not started by a terminal

I have several launchers on my desktop for various programs, and there is a "run in a terminal" setting for those launchers. When I check that setting, the program runs from a terminal, and logs its ...
2
votes
2answers
118 views

what happens when a window manager is put to background

I am trying to understand the situation why .xsession file expects the last process to be in foreground otherwise it is supposed to stop X11 session. I have a small stand-alone script. when I run ...
2
votes
2answers
62 views

Read umask for a user

Plenty of examples on how to set umask for a user... but how do you read (or uncover) the default umask for a given user (say the logged in user)
2
votes
0answers
113 views

How do you write test cases for a web server that uses posix sockets? [closed]

I know how to test it experimentally by running the program, but ideally I would like to test each function I write as I write it. Usually I can't test my functions until I write a whole bunch of ...
1
vote
1answer
271 views

What is difference between POSIX and bash and other shell scripts?

While going through many answers on Unix.SE, I come across many of them writing their contents w.r.t to Posix or Bash or some other standard. I know of some differences like some have arrays and some ...
3
votes
2answers
119 views

POSIX test and -a

I checked a script of mine with checkbashisms and I got the following warnings: possible bashism in check_ssl_cert line 821 (test -a/-o): if [ -n "${ALTNAMES}" -a -n "${COMMON_NAME}" ] ; then In ...
1
vote
2answers
198 views

Is it better to archive/move mail based on mtime or ctime?

I have been using a perl script to archive mail found here The script uses ctime to process and decide which month sub folder to place mail. In most cases this is fine since the ctime = mtime and ...
5
votes
4answers
2k views

sed on OSX insert at a certain line

So I've been using 'sed' on linux for a while, but have had a bit of difficulty trying to use it on OSX since 'POSIX sed' and 'GNU sed' have so many little differences. Currently I'm struggling with ...
30
votes
2answers
1k views

What is the point of the `cd` external command?

As referenced in this fine answer, POSIX systems have an external binary cd in addition to the shell builtin. On OS X 10.8 it's /usr/bin/cd. You can't use it like the builtin cd since it exits ...
3
votes
1answer
135 views

the return built-in

According to the Open Group, [t]he return utility shall cause the shell to stop executing the current function or dot script. If the shell is not currently executing a function or dot script, ...
6
votes
2answers
219 views

What is difference between [ and [[ in BASH? [duplicate]

Possible Duplicate: using single or double bracket - bash When should I use a single bracket? [ When should I use double brackets? [[ Are both POSIX compliant?
14
votes
2answers
2k views

How can I test for POSIX compliance for shell scripts?

Probably the main thing that this website has taught me so far is the importance of writing portable shell scripts. Considering that POSIX is the closest thing to a common standard between all ...