I’ve been trying to find a workaround to defining lists of sequential numbers extensively in tcsh, ie. instead of doing:
i = ( 1 2 3 4 5 6 8 9 10 )
I would like to do something like this (knowing it doesn’t work)
i = ( 1..10 )
This would be specially usefull in foreach loops (I know I can use while, just trying to look for an alternative).
Looking around I found this:
foreach $number (`seq 1 1 9`)
...
end
Found that here. They say it would generate a list of number starting with 1, with increments of 1 ending in 9.
I tried it, but it didn’t work. Apparently seq isn’t a command. Does it exist or is this plain wrong?
Any other ideas?
seqcertainly exists, but perhaps not on your system since it is not in the POSIX standard. I just noticed you have two errosr in your command. Does the following work?Notice the omission of the dollar sign and the extra backticks around the
seqcommand.If that still doesn’t work you could emulate
seqwithawk:Update
Two more alternatives:
If your machine has no
seqit might havejot(BSD/OSX):I had never heard of
jotbefore, but it looks likeseqon steroids.Use
bashwith built-in brace expansion: