Apr. 19th, 2011

The following command pretends to be the most complicated simple command in Shell, without escape sequences, quoted expressions, word expansions and the rest of Shell grammar but simple commands.

The command itself is commented out and described below in a more readable script. The command or its parts could be of use for an interview quiz, for instance, as it touches all the relevant tokens specified by the standard and several non-obvious interpretations.
#0>& 1 >&- X= 2>>-3- =X= 4<<-5- =X 6<>7 8>|9 0<& 1 <& -

CMD="=X="
ARG="=X"

ERRFILE="-3-"
IOFILE="7"
OUTFILE="9"

X="" $CMD $ARG 2>>$ERRFILE 6<>$IOFILE 8>|$OUTFILE 4<<- 5-
	Here-document starts.

	This is a sample text.

	That's it.
5-

Profile

Anton Salikhmetov

November 2018

S M T W T F S
    123
45678 910
11121314151617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 22nd, 2025 04:16 am
Powered by Dreamwidth Studios