POSIX is an acronym for "Portable Operating System Interface", a family of standards specified by the IEEE for maintaining compatibility between operating systems.
23
votes
2answers
1k 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?
32
votes
3answers
3k 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 ...
10
votes
4answers
542 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 ...
17
votes
2answers
506 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 ...
17
votes
3answers
1k 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?
10
votes
2answers
704 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 ...
10
votes
2answers
1k 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 ...
9
votes
2answers
925 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 ...
0
votes
1answer
297 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 ...