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

3
votes
1answer
1k 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
434 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
131 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
64 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
135 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
335 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
130 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
205 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 ...
6
votes
4answers
3k 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 ...
33
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
136 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
246 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
3k 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 ...
1
vote
1answer
118 views

Linking “..” do somewhere other than parent directory and other strange fs beharviors

Can the entry ".." become linked to someplace other than the parent directory? Is it possible to cause "tar" to create this weird behavior? Scenario: I have a pre-built compiler to a embeded system, ...
1
vote
1answer
1k views

Disabling readahead with hdparm or POSIX_FADV_RANDOM

From Linux kernel's doc the advice POSIX_FADV_RANDOM seems to disable readahead. But whent I disable Readhead using (sudo hdparm -A 0 /dev/sdb) I get huge degradation in performances; also noticed ...
5
votes
1answer
1k views

A couple arithmetic related commands, Dash, POSIX shell, sh, Increment

When pre/post incrementing a variable, in POSIX Shell, what is the difference between these two examples. They seem like they would have the same consequences, but would they be used differently? ...
5
votes
4answers
697 views

Is there a difference between these two commands?

cat a > b and cp a b If they are functionally the same for all intents and purposes, which one is faster?
2
votes
2answers
313 views

find command for the newest 500 files in a directory tree and also be POSIX compliant

I am looking for a single line shell script or unix command to find the newest 500 files in a directory. Major constraints are it should be POSIX complaint and the directory can have tons of files.
7
votes
1answer
194 views

Does POSIX guarantee that the standard utilities are in PATH?

In the "Command Search and Execution" section, the POSIX specification says that PATH is searched when finding a utility to execute (with some exceptions). Does the specification mention anywhere ...
14
votes
2answers
1k views

Portability of “> /dev/stdout”

Occasionally I need to specify a "path-equivalent" of one of the standard IO streams (stdin, stdout, stderr). Since 99% of the time I work with Linux, I just prepend /dev/ to get /dev/stdin, etc., ...
0
votes
1answer
226 views

POSIX conformance: NetBSD 5.1 <sys/time.h> gettimeofday declaration

I'm compiling some code which requests POSIX 1003.1 1993 conformance via -D_POSIX_C_SOURCE=2. The code includes the header <sys/time.h> and wants to call gettimeofday, but on NetBSD 5.1 there ...
4
votes
3answers
261 views

Why is there a type for process ids (pid_t), but not for file descriptors (fd)?

I see that pid_t is typedef'd in unistd.h, and file descriptors are defined to be int in fcntl.h. But since they are used in similar ways, wouldn't it make sense to have a typedef for file ...
6
votes
1answer
520 views

A minimal POSIX conformant operating system

For educational purposes, I'd like to start with a POSIX compliant base, including a shell, basic utilities, and an ANSI C compiler, then see what kind of environments I can build by putting packages ...
0
votes
1answer
600 views

POSIX and Bash, sh shorthand, for compound if statement

I prefer to do my sh commands in shorthand, And I prefer to be in POSIX. Truthfully, if the script can run on Dash, that is good enough. Which means using the test command [, not the extended [[. I ...
4
votes
1answer
121 views

Why not just use standard streams instead of using filenames?

While I understand that programs like mv need an actual filename as a parameter, programs like sort could just read from standard input and write to standard output like names | sort > names ...
12
votes
2answers
1k views

Why do some applications use ~/.config/appname for their config data while others use ~/.appname?

I've noticed that some applications put their configuration files to ~/.config/appname while others use ~/.appname (the classic way, AFAIK) for this. What's the sense in this distinction and what ...
1
vote
2answers
856 views

Should I end my text/script files with a newline? [duplicate]

Possible Duplicate: What's the point in adding a new line to the end of a file? What is considered better behaviour: to leave the last letter of the last line to be the last byte of a ...
14
votes
3answers
730 views

Newlines in filenames

I understand and accept the premise that defensive1 shell scripting is both prudent and, in the longer term, more sustainable. Many of the answers to text processing questions here follow this ...
6
votes
2answers
419 views

Where can I find official POSIX and UNIX documentation?

I am looking for official documents on all POSIX standards and specifications. I would like to be able t read the docs to get a better understanding of UNIX systems and how they work at a low level. ...
1
vote
0answers
30 views

Open Group Base Specifications, Single UNIX Specification and POSIX [duplicate]

Possible Duplicate: What differences are between POSIX and Single UNIX Specification? Having asked about the relation between POSIX and Single UNIX Specification, I was now wondering what ...
25
votes
3answers
3k views

Difference between POSIX, Single UNIX Specification, and Open Group Base Specifications?

What are the differences between POSIX, the Single UNIX Specification, and the Open Group Base Specifications? I think their purpose is for determining if an OS is Unix?
40
votes
3answers
5k views

What exactly is POSIX?

I see POSIX mentioned often and everywhere, and I had assumed it to be the baseline UNIX standard.. until I noticed the following excerpt on a Wikipedia page: The Open Group The Open Group is ...
6
votes
1answer
741 views

What does 'uni' mean in unistd.h

What does uni mean in unistd.h Does it mean unix? or universal? What is it?
14
votes
2answers
2k views

How do I test to see if an application exists in $PATH?

I'm trying to write all of my sh startup/env scripts to work with as much DRY and as much: "works on every *nix I clone it to", as possible. This means making sure that if I try to run code that's not ...
2
votes
1answer
177 views

Why does the local::lib shell code use eval and $()

using local::lib requires you to add a line to your ~/.shellrc eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib) I don't understand what the point of using eval, and encasing the statement in $() ...
14
votes
4answers
798 views

keep duplicates out of $PATH on source

I have the following code that's source-d by my .shellrc PATH="${PATH}:${HOME}/perl5/bin" PATH="${PATH}:${HOME}/.bin" export PATH but if I make changes to other code and then source this file, my ...
36
votes
2answers
3k views

$VAR vs ${VAR} and to quote or not to quote

I can write VAR=$VAR1 VAR=${VAR1} VAR="$VAR1" VAR="${VAR1}" the end result to me all seems about the same. Why should I write one or the other? are any of these not portable/POSIX?