@zephyr@lemmy.worldM to linuxmemes@lemmy.world • 1 year agoWhich way do you expand variables?lemmy.worldimagemessage-square20fedilinkarrow-up1103arrow-down12
arrow-up1101arrow-down1imageWhich way do you expand variables?lemmy.world@zephyr@lemmy.worldM to linuxmemes@lemmy.world • 1 year agomessage-square20fedilink
minus-square@RazorsLedge@lemmy.worldlinkfedilink22•edit-21 year agofoo=ding foobar=dong echo \$foobar Brackets make it explicit what you’re trying to do. Do you want “dingbar” or do you want “dong”? I forget what the actual behavior is if you don’t use brackets here, because I always use brackets for this reason now
minus-square@subtext@lemmy.worldlinkfedilink5•1 year agoI believe the actual behavior here would be printing “dong” as the shell interpreter is greedy in its evaluation of variables.
minus-square@vrighter@discuss.tchncs.delinkfedilink2•1 year agothe actual behavior here is to echo the literal string “$foobar”, because the $ sign is escaped. so no variable expansion will take place at all.
minus-square@RazorsLedge@lemmy.worldlinkfedilink2•1 year agoOh lol. It doesn’t show the $ at all on my mobile app till I escaped it
minus-square@vrighter@discuss.tchncs.delinkfedilink2•1 year agoah, so it’s up to the client. I’m using jerboa, in this case
foo=ding foobar=dong echo \$foobar
Brackets make it explicit what you’re trying to do. Do you want “dingbar” or do you want “dong”? I forget what the actual behavior is if you don’t use brackets here, because I always use brackets for this reason now
I believe the actual behavior here would be printing “dong” as the shell interpreter is greedy in its evaluation of variables.
the actual behavior here is to echo the literal string “$foobar”, because the $ sign is escaped. so no variable expansion will take place at all.
Oh lol. It doesn’t show the $ at all on my mobile app till I escaped it
ah, so it’s up to the client. I’m using jerboa, in this case