, and the comments to it, had me read the  to figure out whether /dev/stdin, /dev/stdout and /dev/stderr were actually needed for conformance to the POSIX standard.  It turns out they are not:     The system may provide non-standard extensions. These are features not required by POSIX.1-2008 and may include, but are not limited to: [...] Additional character special files with special properties (for example, /dev/stdin, /dev/stdout, and /dev/stderr)   As far as I can find, this is the only mentioning of these files in the standard.  I have access to only one "system" (environment, really) which does not implement them, and that's MinGW on Windows (no /dev at all as far as I can see).  As far as I know, all the free Unices have them, and so does Cygwin, Windows' new Linux environment and Darwin/macOS.  I'm not well versed with the commercial Unices though.  Is there a POSIX system, Unix, or a Unix-like environment of some description, alive today, that does not implement /dev/stdin, /dev/stdout, and /dev/stderr as files in the filesystem?
122811
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., and this "seems to do the right thing".  But, for one thing, I've always been uneasy about such a rationale (because, of course, "it seems to work" until it doesn't).  Furthermore, I have no good sense for how portable this maneuver is.  So I have a few questions:   In the context of Linux, is it safe (yes/no) to equate stdin, stdout, and stderr with /dev/stdin, /dev/stdout, and /dev/stderr? More generally, is this equivalence "adequately portable"?   I could not find any POSIX references.
45230
Obsolete since end of June, 2015.  As probably widely is known, the indexing tool Xindy is not included in the TeX distribution MiKTeX. Because MakeIndex does not work well with Unicode, but Xindy does, I therefore have a question:  Could Xindy installed by hand, and, if yes, how could this be done?
11071
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 is most famous as the   certifying body for the UNIX   trademark, and its publication of   the Single UNIX Specification   technical standard, which extends   the POSIX standards and is the   official definition of a UNIX system.     If the official definition of a UNIX system is an extension of POSIX, then what exactly is POSIX? ,,, It surely seems to be a touchstone of the UNIX world, but I don't know how it fits into the overall picture.
12319
I am studying for an exam and I am confused as to how canonical vs. non-canonical input/output works in Unix (e.g., curses).  I understand that there is a buffer to which "line disciplines" are applied for canonical input.  Does this mean that the buffer is bypassed for non-canonical input, or does it simply mean that no line disciplines are applied?  How does this process differ for input and output operations?  In the curses programs I have worked with that demonstrate canonical input, the input typed by a user is automatically entered either after a certain number of characters have been typed or a certain amount of time has passed.  Are either of these things considered "line disciplines" or is this something else entirely?
85780
I would like to know which are the standard commands available in every Linux system.  For example if you get a debian/ubuntu/redhat/suse/arch/slackware etc, you will always find there commands like:  cd, mkdir, ls, echo, grep, sed, awk, ping etc.  I know that some of the mentioned commands are shell-builtin but others are not but they are still always there (based on my knowledge and experience so far).   On the other hand commands like gawk, parted, traceroute and other quite famous commands are not installed by default in different Linux distributions.  I made different web searches but I haven't found a straight forward answer to this.  The purpose is that I would like to create a shell script and it should make some sanity checks if the commands used in the script are available in the system. If not, it should prompt the user to install the needed binaries.
54085
I have explored almost    , to no avail.  Let me describe the problem in detail:  I run some unattended scripts and these can produce standard output and standard error lines, I want to capture them in their precise order as displayed by a terminal emulator and then add a prefix like "STDERR: " and "STDOUT: " to them.  I have tried using pipes and even epoll-based approach on them, to no avail. I think solution is in pty usage, although I am no master at that. I have also peeked into the source code of , but that has not been much productive.   Ideally I would use  instead of Bash to accomplish this, but I have not been able to. Seems like pipes automatically forbid keeping a correct lines order because of buffering.  Has somebody been able to do something similar? Or it is just impossible? I think that if a terminal emulator can do it, then it's not - maybe by creating a small C program handling the PTY(s) differently?  Ideally I would use asynchronous input to read these 2 streams (STDOUT and STDERR) and then re-print them second my needs, but order of input is crucial!  NOTE: I am aware of  but it does not work for me with Bash scripts and cannot be easily edited to add a prefix (since it basically wraps plenty of syscalls).  Update: added below two gists       (sub-second random delays can be added in the sample script I provided for a proof of consistent results)  Update: solution to this question would also solve , as @Gilles pointed out. However I have come to the conclusion that it's not possible to do what asked here and there. When using 2&gt;&amp;1 both streams are correctly merged at the pty/pipe level, but to use the streams separately and in correct order one should indeed use the approach of  that involves syscall hooking and can be seen as dirty in many ways.  I will be eager to update this question if somebody can disprove the above.
79031
As usual, when my brain's messing with something I can't figure out myself, I come to you guys for help :)  This time I've been wondering why stdafx.h works the way it does? To my understanding it does 2 things:   Includes standard headers which we might (?) use and which are rarely changed Work as a compiler-bookmark for when code is no longer precompiled.   Now, these 2 things seems like two very different tasks to me, and I wonder why they didn't do two seperate steps to take care of them? To me it seems reasonable to have a #pragma-command do the bookmarking stuff and to optionally have a header-file a long the lines of windows.h to do the including of often-used headers... Which brings me to my next point: Why are we forced to include often-used headers through stdafx.h? Personally, I'm not aware of any often used headers I use that I'm not already doing my own includes for - but maybe these headers are necessary for .dll generation?  Thx in advance
19442
I can never remember how I do this because it comes up so infrequently for me. But in C or C++, what is the best way to read a character from standard input without waiting for a newline (press enter).  Also ideally it wouldn't echo the input character to the screen. I just want to capture keystrokes with out effecting the console screen.
100477
So by any other command the executable file exists, yet when I try to execute it, it claims it is not there.  It is not a special character in the name because I renamed it though a "cat". And it seems to be a binary for the correct architecture... "seems", I guess the question is, what else throws tat error message BESIDES... the file not being there, because it obviously IS!  ldd xls      linux-gate.so.1 =&gt;  (0xb77bc000)     libQtGui.so.4 =&gt; /usr/lib/i386-linux-gnu/libQtGui.so.4 (0xb6cc2000)     libpng12.so.0 =&gt; /lib/i386-linux-gnu/libpng12.so.0 (0xb6c98000)     libSM.so.6 =&gt; /usr/lib/i386-linux-gnu/libSM.so.6 (0xb6c8f000)     libICE.so.6 =&gt; /usr/lib/i386-linux-gnu/libICE.so.6 (0xb6c76000)     libXrender.so.1 =&gt; /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb6c6d000)     libfreetype.so.6 =&gt; /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb6bd1000)     libfontconfig.so.1 =&gt; /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb6b9b000)     libXext.so.6 =&gt; /usr/lib/i386-linux-gnu/libXext.so.6 (0xb6b88000)     libX11.so.6 =&gt; /usr/lib/i386-linux-gnu/libX11.so.6 (0xb6a50000)     libm.so.6 =&gt; /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb6a2a000)     libQtSql.so.4 =&gt; /usr/lib/i386-linux-gnu/libQtSql.so.4 (0xb69ea000)     libQtCore.so.4 =&gt; /usr/lib/i386-linux-gnu/libQtCore.so.4 (0xb6704000)     libz.so.1 =&gt; /lib/i386-linux-gnu/libz.so.1 (0xb66ea000)     libgthread-2.0.so.0 =&gt; /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb66e7000)     libglib-2.0.so.0 =&gt; /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb65ea000)     libgobject-2.0.so.0 =&gt; /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb6598000)     librt.so.1 =&gt; /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xb658f000)     libpthread.so.0 =&gt; /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb6575000)     libdl.so.2 =&gt; /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb6571000)     libstdc++.so.6 =&gt; /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6485000)     libgcc_s.so.1 =&gt; /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6468000)     libc.so.6 =&gt; /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb6305000)     libaudio.so.2 =&gt; /usr/lib/i386-linux-gnu/libaudio.so.2 (0xb62ea000)     libuuid.so.1 =&gt; /lib/i386-linux-gnu/libuuid.so.1 (0xb62e4000)     libexpat.so.1 =&gt; /lib/i386-linux-gnu/libexpat.so.1 (0xb62ba000)     libxcb.so.1 =&gt; /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb6297000)     /lib/ld-lsb.so.3 =&gt; /lib/ld-linux.so.2 (0xb77bd000)     libpcre.so.3 =&gt; /lib/i386-linux-gnu/libpcre.so.3 (0xb6258000)     libffi.so.5 =&gt; /usr/lib/i386-linux-gnu/libffi.so.5 (0xb624f000)     libXt.so.6 =&gt; /usr/lib/i386-linux-gnu/libXt.so.6 (0xb61f1000)     libXau.so.6 =&gt; /usr/lib/i386-linux-gnu/libXau.so.6 (0xb61ee000)     libXdmcp.so.6 =&gt; /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb61e8000)   uname -m (Also, my distribution is Debian wheezy.)  i686   file xls  xls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),       dynamically linked (uses shared libs), for GNU/Linux 2.6.15,      BuildID[sha1]=0xa9786f61b371a683ae4306792f95e0636c288883, not stripped   ls -ld xls  -rwxr-xr-x 1 root root 4634064 May 20 14:35 xls   cat  root@pc170:# cat xls &gt; zls root@pc170:# ./zls -su: ./zls: Permission denied root@pc170:# chmod +x zls root@pc170:# ./zls -su: ./zls: No such file or directory   time  root@pc170:# time ./zls -su: ./zls: No such file or directory  real    0m0.002s user    0m0.000s sys     0m0.000s
59875
The question says it all. I currently use Arch Linux and the zsh, but I'd like a solution that (at minimum) works both on VTs and in xterms and also (hopefully, preferably) will continue to work if I switch distros or shells.  I've heard wildly disparate answers to this question in different distros' docs. Ubuntu says "use .pam_environment". I think in Arch what they recommend depends on your shell. Currently I put everything in  and if a shell doesn't source that for some reason (e.g. bash if .bash_profile exists), I override that by manually sourcing it. But it seems like there must be a better way.
59334
I've read several question about double dash:      However I remember about a teacher 4 years ago telling me that -- was the posix way of dealing with long switches like --help or --color=. Today, I'm using a lot of command where this rule is not respected at all and the best example I can came up with is find where no long switches takes a double-dash even with the very annoying AIX find.    Was my teacher wrong? or does the rule changes since (which seems unlikely)? And finally, is there any posix rules about the length of option and - or -- ?
118761
Preface: I love bash and have no intention of starting any sort of argument or holy-war, and hopefully this is not an extremely naive question.  This question is somewhat related to  on superuser, but I don't think the OP really knew what he was asking for.  I use bash on FreeBSD, linux, OS X, and cygwin on Windows.  I've also had extensive experience recently with PowerShell on Windows.  Is there a shell for *nix, already available or in the works, that is compatible with bash but adds a layer of object-oriented scripting into the mix?  The only thing I know of that comes close is the python console, but as far as I can tell it doesn't provide access to the standard shell environment.  For example, I can't just cd ~ and ls, then chmod +x file inside the python console.  I would have to use python to perform those tasks rather than the standard unix binaries, or call the binaries using python code.  Does such a shell exist?
82601
I'm trying to convert an incoming sting of 1s and 0s from stdin into their respective binary values (where a string such as "11110111" would be converted to 0xF7). This seems pretty trivial but I don't want to reinvent the wheel so I'm wondering if there's anything in the C/C++ standard libs that can already perform such an operation?
48705
When using 's \includegraphics you can specify the file extension or not. For generic use and perhaps portability, extensions are commonly dropped. The types of "approved" inclusions and their order of precedence depends on the driver/compiler being used. What are these driver-defaults?  Related:
20796
I was wondering where I can find and learn some general idea about the command line interface used in Linux and bash? As to now, I have found pieces of such information only from experience, such as   For cat, without any further arguments, it accepts stdin input. But you may explicitly specify STDIN using the special name -, and both ways are equivalent. cat can also accept a filename as cat filename. So is - meant to fill in an argument supposed for filename? Is this usage of - also common for other commands? In chardet &lt;&lt;&lt;somestring, &lt;&lt;&lt; means a string  is used as stdin, the same as echo somestring | chardet. Is this usage of &lt;&lt;&lt; also common? In cut -c 1-3,20,25- employees, is the way 1-3,20,25- to specify a range of numbers for an argument also common in other commands?  Last but not least,  are these general ideas common to just within bash, or within Linux and Unix, or within software using getopt as command line parser?
38933
I'm porting a relatively simple console program written for Unix to the Windows platform (). All the source files include "unistd.h", which doesn't exist.  Removing it, I get complaints about misssing prototypes for 'srandom', 'random', and 'getopt'. I know I can replace the random functions, and I'm pretty sure I can find/hack-up a getopt implementation.    But I'm sure others have run into the same challenge.  My question is: is there a port of "unistd.h" to Windows? At least one containg those functions which do have a native Windows implementation - I don't need pipes or forking.  EDIT:  I know I can create my very own "unistd.h" which contains replacements for the things I need - especially in this case, since it is a limited set. But since it seems like a common problem, I was wondering if someone had done the work already for a bigger subset of the functionality.  Switching to a different compiler or environment isn't possible at work - I'm stuck with Visual Studio.
113339
I'm new to Mac usage.  It seems that most commands trip over options given after the file names. In linux, which I've used for years, it doesn't matter.  On Apple, it does.  Is there some setting somewhere or some hack to make commands like ls behave "normal"?  dwilson 0====&gt; ls -l p* -rw-r--r--@ 1 dwilson  owner  184 Jul 29 13:57 poo.c -rw-r--r--@ 1 dwilson  owner  133 Jul 29 13:57 poo.h  dwilson 0====&gt; ls p* -l ls: -l: No such file or directory poo.c        poo.h  dwilson 1====&gt;