有一种方法可以使新变量默认在zsh中局部范围范围? thike setopt magic_local_opt; x = 1 功能foo { x = 2 } 回声$ x 打印“ 1”

问题描述 投票:0回答:1
印刷'1'.

使用这个:

function foo { typeset x=2 # Makes x local to the function } x=1 foo echo $x # This will print 1
zsh
1个回答
0
投票

© www.soinside.com 2019 - 2025. All rights reserved.