On 08Aug2016 16:36, Joe Zeff <joe(a)zeff.us> wrote:
On 08/08/2016 04:32 PM, cs(a)zip.com.au wrote:
>On 08Aug2016 16:18, Joe Zeff <joe(a)zeff.us> wrote:
>>On 08/08/2016 04:12 PM, Cameron Simpson wrote:
>>> >1aa.lwp
>>>
>>>on its own. The shell will open and trucate it, then close it, running
>>>no command. Thus, an empty file.
>>
>>No. What you will get is this:
>>
>>bash: laa.lwp: command not found
>>
>>What you need is this:
>>
>>touch laa.lwp
>
>You must have a very weird shell. I've been doing this literally for
>decades. Works perfectly.
I see the difference: I'd left out the redirection, which made laa.lwp
into a command. Thanx for the correction, because that's an elegant way to
create an empty file.
Also:
>file # safety create file (doesn't truncate it)
</dev/rst0 # rewind tape drive
</dev/nrst0 # fast forward tape to next file
/dev/rst0 # write termination file to tape, then rewind
# (convention: empty file indicates end of tape)
and of course the "exec" with no command variation for opening files by the
current shell and not letting go:
exec 3>>logfile # attach fd 3 to a log file from now on
... script stuff ...
echo blah >&3 # write to log
... script stuff ...
exec 3<&- # close log file
etc.
Cheers,
Cameron Simpson <cs(a)zip.com.au>