help-bash
[Top][All Lists]
Advanced

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

Re: Order of command substitution and arithmetic expansion


From: Dongbo Hu
Subject: Re: Order of command substitution and arithmetic expansion
Date: Sat, 13 Nov 2021 14:21:55 -0500

> If arithmetic expansion happened last in all cases, then the first result 
> should have been the same as the second result.

Thank you for your reply. I suppose you meant "If arithmetic expansion happened 
last in all cases, then the first result should have been DIFFERENT from the 
second result?

One reason that I asked this question is because O’Reilly book “Learning the 
bash shell” (by Cameron Newham and Bill Rosenblatt, 3rd Edition, 2005) claimed 
that command substitution is before arithmetic expansion (pp180-182), and I 
never doubted it until reading the reference manual recently. 

I also took a quick look at the source code, but it’s a little complex and I 
can’t tell for sure the exact order. Interestingly, the comments in source code 
always put command substitution before arithmetic expansion. 




reply via email to

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