[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reporting a bug
From: |
Greg Wooledge |
Subject: |
Re: reporting a bug |
Date: |
Thu, 15 Dec 2022 13:09:56 -0500 |
On Thu, Dec 15, 2022 at 10:55:51AM +0000, yair@liberman.co.il wrote:
> function sa {
> for y in $(seq $1 $e2); do
> echo "echo search $y "
> done
> }
As others have pointed out, you've written $e2 instead of $2.
In addition to that, you're relying on the Linux-specific seq(1)
program, which may not be available on other systems. You could
use a C-style for loop instead:
function sa {
local y
for ((y=$1; y <= $2; y++)); do
echo "echo search $y"
done
}
This is more portable, as well as more efficient.