[j-nsp] repeat a character in SLAX certain number of times

Martin T m4rtntns at gmail.com
Thu Mar 22 13:43:52 EDT 2018


Hi!

Let's say I would like to print equals sign $x number of times. In
Python I could do this:

>>> x=5
>>> print("=" * x)
=====
>>>

..or for example, in Bash I could do "for i in $(seq $x); do echo -n
=; done; echo". What is the most elegant way to do this in SLAX? At
the moment I solved it with this:

var $sout = jcs:printf("%.*s", $separator,
    "==========================================" _
    "==========================================" _
    "==========================================" _
    "==========================================");

It works, because I know, that $separator is less than 168 characters
long, but maybe there is a better solution.


thanks,
Martin


More information about the juniper-nsp mailing list