[Aboriginal] aboriginal changes
Geoff Salmon
gsalmon at se-instruments.com
Tue Nov 17 07:04:45 PST 2015
On 15-11-17 09:55 AM, Rob Landley wrote:
>> > sha1file()
>> > {
>> >- sha1sum "$@" | awk '{print $1}'
>> >+ sha1sum /dev/null "$@" | tail -n +2 | awk '{print $1}'
>> > }
>> >
>> >Except then you can't pipe input into sha1file. I don't see this being
>> >done anywhere, but maybe it's something you want to support.
I was wrong about not supporting piping into sha1file. You just have to
be explicit about it and pass a "-" argument.
> sha1sum /dev/null gives an sha1sum, probably doesn't hurt anything in
> this case but it's a behavior change. Sounds like an existence test is
> needed somewhere.
sha1sum /dev/null does always return a hash, but the tail -n +2 ignores it.
> Ok, let's say sha1file outputs the sha1sums of its arguments, and with
> no arguments outputs nothing. That means the existence test needs to go
> in sha1file, so a for loop over the returned values. (Which would break
> if a filename has a space in it but that's already the case...)
Are you saying the existence check is needed to handle the no args case
or to handle non-existent args? If it's for the no args case, I think
sha1sum /dev/null | tail -n +2 is simpler. If you want to support
non-existent args, then 2>/dev/null either inside or outside sha1file as
before seems fine.
- Geoff
More information about the Aboriginal
mailing list