Skip to main content
added 146 characters in body
Source Link
Eric Renouf
  • 18.7k
  • 7
  • 51
  • 66

You have the wrong type of quotes around seq $linecount. You have single quotes, which make the whole phrase get treated as a single string. If you want to execute it and use the results you want backticks:

`seq $linecount` 

or, better now, use the $(...) syntax which does the same

for num in $(seq $linecount) 

or you could do it without the other program at all:

num=1 while [ "$num" -le "$linecount" ]; do ... ((num=num+1)) done 

If you're trying to print out the first N lines of the file though you should probably use just head:

head -n "$linecount" misspelled 

You have the wrong type of quotes around seq $linecount. You have single quotes, which make the whole phrase get treated as a single string. If you want to execute it and use the results you want backticks:

`seq $linecount` 

or, better now, use the $(...) syntax which does the same

for num in $(seq $linecount) 

or you could do it without the other program at all:

num=1 while [ "$num" -le "$linecount" ]; do ... ((num=num+1)) done 

You have the wrong type of quotes around seq $linecount. You have single quotes, which make the whole phrase get treated as a single string. If you want to execute it and use the results you want backticks:

`seq $linecount` 

or, better now, use the $(...) syntax which does the same

for num in $(seq $linecount) 

or you could do it without the other program at all:

num=1 while [ "$num" -le "$linecount" ]; do ... ((num=num+1)) done 

If you're trying to print out the first N lines of the file though you should probably use just head:

head -n "$linecount" misspelled 
Source Link
Eric Renouf
  • 18.7k
  • 7
  • 51
  • 66

You have the wrong type of quotes around seq $linecount. You have single quotes, which make the whole phrase get treated as a single string. If you want to execute it and use the results you want backticks:

`seq $linecount` 

or, better now, use the $(...) syntax which does the same

for num in $(seq $linecount) 

or you could do it without the other program at all:

num=1 while [ "$num" -le "$linecount" ]; do ... ((num=num+1)) done