【发布时间】:2021-01-19 18:25:10
【问题描述】:
我有用 powershell 编写的脚本,它得到 0 到 N 之间的斐波那契数列。
代码:
$n = $args[0]
Function Get-Fib ($n) {
$current = $previous = 1;
while ($current -lt $n) {
$current;
$current,$previous = ($current + $previous),$current}
}
Get-Fib $n
输入:& .\script2.ps1 7
预期输出:1 1 2 3 5
但是,现在输出看起来像这样:
1
2
3
5
是否可以在此脚本中不使用换行符获得输出?
【问题讨论】:
标签: powershell formatting output