I was curious what POSIX says and how other *nix systems would handle Christian's examples.
On the 'r' command POSIX makes a general comment: The r and w command verbs, and the w flag to the s command, take an rfile (or wfile) parameter... and specifically about 'r': If rfile does not exist or cannot be read, it shall be treated as if it were an empty file, causing no error condition. This offers no guidance on how to handle a missing parameter, unless you read 'if rfile does not exist' to mean the parameter rather than the actual file. In practice only GNU sed ignores an 'r' command with no parameter; BusyBox, FreeBSD, Solaris and Version 7 UNIX[1] treat it as an error. On newlines, POSIX only offers: In default operation, sed cyclically shall append a line of input, less its terminating <newline> character, into the pattern space. Given Christian's sample file with no trailing newline and the command 'sed -n p /tmp/bar' GNU sed returns all three lines with no newline on the last; BusyBox and FreeBSD return all three lines with a newline on the last; Solaris and Version 7 UNIX only return the first two lines. So, you pays your money and you takes your choice. Busybox sed's behaviour is certainly consistent with *nix tradition. We're just lucky to have so many traditions to choose from. Ron --- [1] http://www.nordier.com/v7x86/index.html has a virtual machine with UNIX v7 for x86. _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox