Timeline for Bash variable scope
Current License: CC BY-SA 4.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 5, 2019 at 13:37 | comment | added | Fabio says Reinstate Monica | There's a Bash FAQ about this: mywiki.wooledge.org/BashFAQ/024 | |
| Jul 5, 2019 at 13:36 | history | edited | Fabio says Reinstate Monica | CC BY-SA 4.0 |
Added tags, fixed code formatting and grammar
|
| Aug 24, 2016 at 13:04 | answer | added | Adrian May | timeline score: 4 | |
| Nov 27, 2014 at 16:24 | answer | added | sano | timeline score: 13 | |
| Nov 2, 2014 at 16:49 | answer | added | Rammix | timeline score: 3 | |
| Apr 11, 2011 at 17:33 | answer | added | freethinker | timeline score: 3 | |
| Sep 23, 2008 at 22:37 | answer | added | mweerden | timeline score: 127 | |
| Sep 23, 2008 at 22:33 | vote | accept | Matt P | ||
| Sep 23, 2008 at 22:29 | answer | added | pixelbeat | timeline score: 170 | |
| Sep 23, 2008 at 22:16 | history | edited | Matt P | CC BY-SA 2.5 |
clarify the output variable
|
| Sep 23, 2008 at 22:11 | comment | added | Matt P | Agreed.. it seems like it has to do with the "while read" loop? | |
| Sep 23, 2008 at 22:08 | comment | added | Paul Tomblin | Without the cruft, it works for me. #!/bin/bash for i in 1 2 3 4 5; do echo $((++XCODE)) done echo "fin:" $XCODE I think your problem has nothing to do with variable scoping and everything to do with what's happening in the while. | |
| Sep 23, 2008 at 22:03 | answer | added | Kent Fredric | timeline score: 2 | |
| Sep 23, 2008 at 21:59 | comment | added | Matt P | I've tried to throw an "XCODE=0" at the top of the code, outside of the while statement | |
| Sep 23, 2008 at 21:57 | comment | added | Paul Tomblin | Where do you initialize XCODE to something that can be incremented? | |
| Sep 23, 2008 at 21:56 | history | asked | Matt P | CC BY-SA 2.5 |