Afficher un message
Vieux 01/11/2006, 17h54   #13
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: double "triangle" loop for $* ?

On 2006-11-01, Casper H.S Dik wrote:
> Janis Papanagnou <Janis_Papanagnou@hotmail.com> writes:
>
>>Stephane CHAZELAS wrote:
>>> 2006-11-1, 00:22(-05), Bill Marcum:
>>>
>>>>Some systems have the "seq" command:
>>>>for x in `seq 1 10`
>>>
>>> GNU systems, seq is a GNU only command. And that assumes the
>>> newline character is in IFS and that no digits are in IFS.

>
>>If one fiddles with IFS he should take care that any changed
>>IFS has just some well defined preferable local scope, take
>>some precautions to save/restore it, or define it for a single
>>command only.

>
>
> And who needs seq (for most purposes) when you have:
>
> `yes "" | cat -n | head -10`
>
>
> for 10 fill in any number.


But who says you have it?

$ yes "" | cat -n | head -10
cat: cannot open -n: No such file or directory

It works with most versions of cat, but it is not part of the
standard.

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
 
Page generated in 0,06657 seconds with 9 queries