bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] Re: feature request: option to start script not from the very b


From: Stephane CHAZELAS
Subject: Re: [OT] Re: feature request: option to start script not from the very beginning of file
Date: Wed, 3 Aug 2011 14:14:05 +0100
User-agent: slrn/pre1.0.0-18 (Linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]