Powershell: , (1) [1]์ด, $ null๊ณผ ๋‹ค๋ฅธ ์ด์œ ๋Š” ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?

์— ๋งŒ๋“  2018๋…„ 03์›” 10์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: PowerShell/PowerShell

๋‹ค์Œ ๋‘ ๋ฌธ์ด ๋‹ค๋ฅธ ์ถœ๋ ฅ์„ ์ƒ์„ฑํ•˜๋Š” ์ด์œ ๋ฅผ ์ดํ•ดํ•˜๋ ค๊ณ ํ•ฉ๋‹ˆ๋‹ค.

&{,$null} | % {'x'} # x
&{,(1)[1]} | % {'x'} # no output

,$null ๋ฐ ,(1)[1] ๋ชจ๋‘ ๋‹จ์ผ null ์š”์†Œ๋ฅผ ํฌํ•จํ•˜๋Š” ๋ฐฐ์—ด ์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์Šคํฌ๋ฆฝํŠธ ๋ธ”๋ก์—์„œ ์ถœ๋ ฅํ•˜๋Š” ๋™์•ˆ ๋‹ค๋ฅด๊ฒŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚˜๊ณ  ์žˆ์Šต๋‹ˆ๊นŒ?

Issue-Question Resolution-Answered

๋ชจ๋“  3 ๋Œ“๊ธ€

๋‘ ๋ฒˆ์งธ๋Š” ํŒŒ์ดํ”„ ๋ผ์ธ์— ์˜ํ•ด ์—ด๊ฑฐ๋˜์ง€ ์•Š์€ AutomationNull.Value ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

$null ์ด ์—ด๊ฑฐ๋ฉ๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด foreach์˜ ๊ตฌํ˜„์„ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค.
https://github.com/PowerShell/PowerShell/blob/bcf86d4f8a1ce0ef11f0e9100490e790fb067574/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs#L2748

@powercode ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋…์ž๋ฅผ ์œ„ํ•ด AutomationNull ์— ๋Œ€ํ•œ ๋ช‡ ๊ฐ€์ง€ ๋ฆฌ์†Œ์Šค๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

@ alx9r : ์ด๊ฒƒ์€ ๋‚˜์ค‘์— # 6436์—์„œ ๋ฌผ์–ด ๋ณธ ์งˆ๋ฌธ๊ณผ https://github.com/PowerShell/PowerShell/issues/6436#issuecomment -375151317์—์„œ ์ดˆ์ ์„ ๋งž์ถ˜ ์งˆ๋ฌธ์œผ๋กœ ๊ท€๊ฒฐ๋˜์ง€๋งŒ ์ €๋Š” ๊ฒฐ์ •ํ–ˆ์Šต๋‹ˆ๋‹ค ๋ณ„๋„์˜ ์ด์Šˆ ์ƒ์„ฑ : # 6823

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰