2011-08-02, 23:41(+02), mhenn: > Am 02.08.2011 15:55, schrieb Stephane CHAZELAS: [...] >> What about: >> >> #! /bin/bash - >> :||:<<\#__END__ >> >> whatever you like here >> >> #__END__ [...] > Why did you use :||:<< ... > and not just :<<... ? > > when testing it, it doesn't make any difference: [...]
Without ":||", it does create a temporary file, fill it and set it as standard input to the ":" command. With :||:, that does not happen because the second ":" is not run since the first one succeeded. $ strace bash -c $':<<\\E\nE' |& grep tmp stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=12288, ...}) = 0 stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=12288, ...}) = 0 access("/tmp", W_OK) = 0 statfs("/tmp", {...}) = 0 open("/tmp/sh-thd-1312368098", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 open("/tmp/sh-thd-1312368098", O_RDONLY) = 4 unlink("/tmp/sh-thd-1312368098") = 0 $ strace bash -c $':||:<<\\E\nE' |& grep tmp $ -- Stephane