Re: [PATCH] t7422: remove extraneous argument to printf

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

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> On Wed, Apr 9, 2025 at 12:29 PM Subhaditya Nath <sn03.general@xxxxxxxxx> wrote:
>> On Thu, Apr 3, 2025 at 10:35 PM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>> > [...] for the sake of consistency and to match the author's original
>> > intent, it may make more sense to retain the argument to printf and
>> > instead employ `%d`.
>>
>> The problem is, there are multiple ways the printf statement could be
>> written -
>>
>> 1) printf "[submodule \"sm-$i\"]\npath = recursive-submodule-path-$i\n"
>> 2) printf "[submodule \"sm-$i\"]\npath = recursive-submodule-path-%d\n" "$i"
>> 3) printf "[submodule \"sm-%d\"]\npath = recursive-submodule-path-$i\n" "$i"
>> 4) printf "[submodule \"sm-%d\"]\npath = recursive-submodule-path-%d\n" "$i" "$i"
>>
>> Which one of these is to be used?
>
>  The final (#4) seems most natural.

It is unfortunate that this one needs two identical things
interpolated so the overall structure with "for" loop needs to be
retained, and within the constraints, (4) is the only sensible
option, I would say.

The other one in the example in this thread could lose the for loop
by doing

   printf "160000 commit $COMMIT\trecursive-submodule-path-%d\n" \
	   $(test_seq 2000)

but for uniformity with other parts that cannot lose "for" loop, I
would not recommend going in that direction.

Thanks.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux