[Wolves] CLI - how to pass a series of numbers to command
Adam Sweet
adam at adamsweet.org
Mon Aug 11 10:42:27 UTC 2014
On 10/08/2014 18:01, Mark Croft wrote:
> hope this all makes some sense.
>
> i find most of the time when i am doing get_iplayer stuff i want to do
> a whole series - con programme numbers/codes
>
> eg
>
> get_iplayer --get 342 343 344 345 --subtitles 342 343 344 345
>
> is there a better way to do this? some trick? to pass each number
> starting from 342 and ending at 345 , i am sure i have seen it
> somewhere but tried to google for it.
You use curly brackets to express the number range, ie {342..345}
Some links here:
http://stackoverflow.com/questions/169511/how-do-i-iterate-over-a-range-of-numbers-defined-by-variables-in-bash
http://wiki.bash-hackers.org/syntax/expansion/brace
http://www.cyberciti.biz/faq/bash-for-loop/
http://www.cyberciti.biz/faq/unix-linux-iterate-over-a-variable-range-of-numbers-in-bash/
As your numbers in the example don't go over a ten boundary, you could
also do 34{2..5}. Examples:
adam at bunsen:~$ echo {342..345}
342 343 344 345
adam at bunsen:~$ echo 34{2..5}
342 343 344 345
Regards,
Adam Sweet
--
http://blog.adamsweet.org/
More information about the Wolves
mailing list