▲ 1673 ▼ Like programming in bash (lemmy.ml) submitted 2 years ago by cm0002@lemmy.world to c/programmer_humor@programming.dev 185 comments fedilink hide all child comments
[–] SpaceNoodle@lemmy.world 54 points 2 years ago (3 children) Clearly you don't write enough bash scripts. permalink fedilink source hideshow 6 child comments replies: [–] CrazyLikeGollum@lemmy.world 17 points 2 years ago (2 children) Or scripts for basically any other variant of the Bourne shell. They are, for the most part, very cross compatible. permalink fedilink source parent hideshow 4 child comments replies: [–] Tinidril@midwest.social 12 points 2 years ago That's the only reason I've ever done much of anything in shell script. As a network administrator I've worked many network appliances running on some flavor of Unix and the one language I can count on to be always available is bash. It has been well worth knowing for just that reason. permalink fedilink source parent [–] BeigeAgenda@lemmy.ca 2 points 2 years ago (1 child) I wrote a script to do backups on a ESXi it uses Busybox's ASH, one thing I learned after spending hours debugging my scripts was that ASH does not support arrays so you have to do everything with temporary files. permalink fedilink source parent hideshow 2 child comments replies: [–] YouAreLiterallyAnNPC@lemmy.world 4 points 2 years ago (1 child) There actually is an array in any POSIX shell. You get one array per file/function. It just feels bad to use it. You can abuse 'set -- 1 2 3 4' to act as a proper array. You can then use 'for' without 'in' to iterate over it. for i; do echo $i; done. Use shift to pop items off. If I really have to use something more complex, I'll reach for mkfifo instead so I can guarantee the data can only be consumed once without manipulating entries. permalink fedilink source parent hideshow 2 child comments replies: [–] BeigeAgenda@lemmy.ca 1 point 2 years ago Cool, good to know. permalink fedilink source parent [–] Kissaki@programming.dev 6 points 2 years ago (1 child) When I bash my head into a wall, does that count? permalink fedilink source parent hideshow 2 child comments replies: [–] SpaceNoodle@lemmy.world 3 points 2 years ago Only if you scripted it permalink fedilink source parent [–] Thcdenton@lemmy.world 5 points 2 years ago (1 child) Enough is enough permalink fedilink source parent hideshow 2 child comments replies: [–] Klear@sh.itjust.works 3 points 2 years ago I've had enough of these motherfucking scripts on this motherfucking PC! permalink fedilink source parent
[–] CrazyLikeGollum@lemmy.world 17 points 2 years ago (2 children) Or scripts for basically any other variant of the Bourne shell. They are, for the most part, very cross compatible. permalink fedilink source parent hideshow 4 child comments replies: [–] Tinidril@midwest.social 12 points 2 years ago That's the only reason I've ever done much of anything in shell script. As a network administrator I've worked many network appliances running on some flavor of Unix and the one language I can count on to be always available is bash. It has been well worth knowing for just that reason. permalink fedilink source parent [–] BeigeAgenda@lemmy.ca 2 points 2 years ago (1 child) I wrote a script to do backups on a ESXi it uses Busybox's ASH, one thing I learned after spending hours debugging my scripts was that ASH does not support arrays so you have to do everything with temporary files. permalink fedilink source parent hideshow 2 child comments replies: [–] YouAreLiterallyAnNPC@lemmy.world 4 points 2 years ago (1 child) There actually is an array in any POSIX shell. You get one array per file/function. It just feels bad to use it. You can abuse 'set -- 1 2 3 4' to act as a proper array. You can then use 'for' without 'in' to iterate over it. for i; do echo $i; done. Use shift to pop items off. If I really have to use something more complex, I'll reach for mkfifo instead so I can guarantee the data can only be consumed once without manipulating entries. permalink fedilink source parent hideshow 2 child comments replies: [–] BeigeAgenda@lemmy.ca 1 point 2 years ago Cool, good to know. permalink fedilink source parent
[–] Tinidril@midwest.social 12 points 2 years ago That's the only reason I've ever done much of anything in shell script. As a network administrator I've worked many network appliances running on some flavor of Unix and the one language I can count on to be always available is bash. It has been well worth knowing for just that reason. permalink fedilink source parent
[–] BeigeAgenda@lemmy.ca 2 points 2 years ago (1 child) I wrote a script to do backups on a ESXi it uses Busybox's ASH, one thing I learned after spending hours debugging my scripts was that ASH does not support arrays so you have to do everything with temporary files. permalink fedilink source parent hideshow 2 child comments replies: [–] YouAreLiterallyAnNPC@lemmy.world 4 points 2 years ago (1 child) There actually is an array in any POSIX shell. You get one array per file/function. It just feels bad to use it. You can abuse 'set -- 1 2 3 4' to act as a proper array. You can then use 'for' without 'in' to iterate over it. for i; do echo $i; done. Use shift to pop items off. If I really have to use something more complex, I'll reach for mkfifo instead so I can guarantee the data can only be consumed once without manipulating entries. permalink fedilink source parent hideshow 2 child comments replies: [–] BeigeAgenda@lemmy.ca 1 point 2 years ago Cool, good to know. permalink fedilink source parent
[–] YouAreLiterallyAnNPC@lemmy.world 4 points 2 years ago (1 child) There actually is an array in any POSIX shell. You get one array per file/function. It just feels bad to use it. You can abuse 'set -- 1 2 3 4' to act as a proper array. You can then use 'for' without 'in' to iterate over it. for i; do echo $i; done. Use shift to pop items off. If I really have to use something more complex, I'll reach for mkfifo instead so I can guarantee the data can only be consumed once without manipulating entries. permalink fedilink source parent hideshow 2 child comments replies: [–] BeigeAgenda@lemmy.ca 1 point 2 years ago Cool, good to know. permalink fedilink source parent
[–] Kissaki@programming.dev 6 points 2 years ago (1 child) When I bash my head into a wall, does that count? permalink fedilink source parent hideshow 2 child comments replies: [–] SpaceNoodle@lemmy.world 3 points 2 years ago Only if you scripted it permalink fedilink source parent
[–] SpaceNoodle@lemmy.world 3 points 2 years ago Only if you scripted it permalink fedilink source parent
[–] Thcdenton@lemmy.world 5 points 2 years ago (1 child) Enough is enough permalink fedilink source parent hideshow 2 child comments replies: [–] Klear@sh.itjust.works 3 points 2 years ago I've had enough of these motherfucking scripts on this motherfucking PC! permalink fedilink source parent
[–] Klear@sh.itjust.works 3 points 2 years ago I've had enough of these motherfucking scripts on this motherfucking PC! permalink fedilink source parent