LINUX.ORG.RU

История изменений

Исправление ubik, (текущая версия) :

int@blackhorse bash 0 0.26 $ ./foo.bash 
int@blackhorse bash 0 0.26 $ cat 2.txt 
Hello
int@blackhorse bash 0 0.24 $ cat 3.txt 
int@blackhorse bash 0 0.24 $ cat 4.txt 
Hello
int@blackhorse bash 0 0.22 $
int@blackhorse bash 0 0.22 $ cat foo.bash 
#!/usr/bin/env bash

for u in {1..100}.txt; do
	(( ${u%%.*} % 2 == 0 )) && echo "Hello" > "$u"
done
int@blackhorse bash 0 0.14 $

$ shellcheck foo.bash
No issues detected!

Исправление ubik, :

int@blackhorse bash 0 0.26 $ ./foo.bash 
int@blackhorse bash 0 0.26 $ cat 2.txt 
Hello
int@blackhorse bash 0 0.24 $ cat 3.txt 
int@blackhorse bash 0 0.24 $ cat 4.txt 
Hello
int@blackhorse bash 0 0.22 $
int@blackhorse bash 0 0.22 $ cat foo.bash 
#!/usr/bin/env bash

for u in {1..100}.txt; do
	(( ${u%%.*} % 2 == 0 )) && echo "Hello" > "$u"
done
int@blackhorse bash 0 0.14 $

$ shellcheck foo.bash No issues detected!

Исходная версия ubik, :

int@blackhorse bash 0 0.26 $ ./foo.bash 
int@blackhorse bash 0 0.26 $ cat 2.txt 
Hello
int@blackhorse bash 0 0.24 $ cat 3.txt 
int@blackhorse bash 0 0.24 $ cat 4.txt 
Hello
int@blackhorse bash 0 0.22 $
int@blackhorse bash 0 0.22 $ cat foo.bash 
#!/usr/bin/env bash

for u in {1..100}.txt; do
	(( ${u%%.*} % 2 == 0 )) && echo "Hello" > "$u"
done
int@blackhorse bash 0 0.14 $