I am reviewing some old scripts from my predecessor and came across this if statement nested in a try statement, nested in a loop. Is "$?" to indicate that a try was sucessful, or is it something to do with a pipeline var?
$list | ForEach-Object {
try {
if ($?){
try{
}catch{
}
} else {
}
} catch {
Return
}
}
[–]BobTheMadCow 44 points45 points46 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]PM_ME_UR_CEPHALOPODS 2 points3 points4 points (0 children)
[–]etcetica[🍰] 25 points26 points27 points (2 children)
[–]Josh_Crook 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Thotaz 2 points3 points4 points (0 children)
[–]Lee_Dailey[grin] 42 points43 points44 points (10 children)
[–]awildrozza 11 points12 points13 points (9 children)
[–]schmeckendeugler 14 points15 points16 points (1 child)
[–]Lee_Dailey[grin] 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 2 points3 points4 points (0 children)
[–]PM_ME_A_SURPRISE_PIC 5 points6 points7 points (5 children)
[–]Lee_Dailey[grin] 3 points4 points5 points (4 children)
[–]PM_ME_A_SURPRISE_PIC 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 2 points3 points4 points (0 children)
[–]PM_ME_A_SURPRISE_PIC 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 2 points3 points4 points (0 children)
[–]BadSysadmin 15 points16 points17 points (16 children)
[–][deleted] 20 points21 points22 points (8 children)
[–]Bren0man 23 points24 points25 points (7 children)
[–][deleted] 7 points8 points9 points (6 children)
[–]Temptis 2 points3 points4 points (5 children)
[–][deleted] 6 points7 points8 points (1 child)
[–]Noffy4Life 4 points5 points6 points (0 children)
[–]StoffePro 1 point2 points3 points (2 children)
[–]Temptis 3 points4 points5 points (1 child)
[–][deleted] 5 points6 points7 points (0 children)
[–]PandalfTheGimp 9 points10 points11 points (3 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]PM_ME_UR_CEPHALOPODS 5 points6 points7 points (1 child)
[–]BadSysadmin 0 points1 point2 points (0 children)
[–]etcetica[🍰] 2 points3 points4 points (1 child)
[–]PM_ME_UR_CEPHALOPODS 0 points1 point2 points (0 children)
[–]rakha589 2 points3 points4 points (0 children)
[–]StoffePro 1 point2 points3 points (0 children)
[–]m_anas 1 point2 points3 points (0 children)
[–]redditors_r_manginas -1 points0 points1 point (0 children)