Skip to main content
Commonmark migration
Source Link

##Consider seq

Consider seq

Using seq makes your code significantly shorter in those for loops since you can just rely on seq to do your limit checking and the increments. beware that seq is non-standard though.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in $(seq 0 $i $limit) do

thanks to janos for pointing out the grievous flaws in the previous version of my answer

##To Space or not to space?

To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around operators or not doing it at all. I recommend the former. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

##Consider seq

Using seq makes your code significantly shorter in those for loops since you can just rely on seq to do your limit checking and the increments. beware that seq is non-standard though.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in $(seq 0 $i $limit) do

thanks to janos for pointing out the grievous flaws in the previous version of my answer

##To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around operators or not doing it at all. I recommend the former. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

Consider seq

Using seq makes your code significantly shorter in those for loops since you can just rely on seq to do your limit checking and the increments. beware that seq is non-standard though.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in $(seq 0 $i $limit) do

thanks to janos for pointing out the grievous flaws in the previous version of my answer

To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around operators or not doing it at all. I recommend the former. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

added 139 characters in body
Source Link
Vogel612
  • 25.3k
  • 7
  • 58
  • 141

##Use##Consider seq

Using seq makes your code significantly more idiomaticshorter in those for loops since you can just rely on seq to do your limit checking and the increments. beware that seq is non-standard though.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in `seq$(seq 0 $i $limit`$limit) do

thanks to janos for pointing out the grievous flaws in the previous version of my answer

##To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around operators or not doing it at all. I recommend the former. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

##Use seq

Using seq makes your code significantly more idiomatic in those for loops since you can just rely on seq to do your limit checking and the increments.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in `seq 0 $i $limit` do

##To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around operators or not doing it at all. I recommend the former. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

##Consider seq

Using seq makes your code significantly shorter in those for loops since you can just rely on seq to do your limit checking and the increments. beware that seq is non-standard though.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in $(seq 0 $i $limit) do

thanks to janos for pointing out the grievous flaws in the previous version of my answer

##To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around operators or not doing it at all. I recommend the former. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

added 7 characters in body
Source Link
Vogel612
  • 25.3k
  • 7
  • 58
  • 141

##Use seq

Using seq makes your code significantly more idiomatic in those for loops since you can just rely on seq to do your limit checking and the increments.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in `seq 0 $i $limit` do

##To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around itoperators or not doing it at all. I recommend the latterformer. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

##Use seq

Using seq makes your code significantly more idiomatic in those for loops since you can just rely on seq to do your limit checking and the increments.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in `seq 0 $i $limit` do

##To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around it or not doing it at all. I recommend the latter. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

##Use seq

Using seq makes your code significantly more idiomatic in those for loops since you can just rely on seq to do your limit checking and the increments.

for (( i = 0; i <= $limit; i+=$1 )); do

could simply be written as:

for i in `seq 0 $i $limit` do

##To Space or not to space?

Compare your spacing in that for loop header:

for (( i = 0; i <= $limit; i+=$1 )); do

stick to either always adding spaces around operators or not doing it at all. I recommend the former. This makes for a significant readability improvement, especially when not having syntax highlighting or similar.

I'm sure there's more, but that's about the whole extent of my bash knowledge, so I leave the rest in the hands of more competent reviewers :)

Source Link
Vogel612
  • 25.3k
  • 7
  • 58
  • 141
Loading