On Tue, Mar 22, 2016 at 11:35:46AM -0400, Adam Danischewski wrote:
> function update() {
> local -i VAR=45
> local -i TOPSECRET_NUMBER=50 ## No one can know about.
> VAR+=${1}
> echo $VAR
> }
>
> $ update 0
> 45
> $ update TOPSECRET_NUMBER
> 95
>
> ## Successfully deduce that TOPSECRET_NUMBER is
Today's lesson is: intent. Always tell us what you are trying to do.
In a script, that means writing comments. In an email, you can write
plain text anywhere you want.
It's helpful! Try it!
On Tue, Mar 22, 2016 at 10:47:28AM -0400, Adam Danischewski wrote:
> $ alias t2='_() { /tmp/m.bsh -d "cl
Thanks for the quick reply, I hit send by accident, the first part is clear
in the documentation.
On the second part, I still see a potential problem because Bash is
allowing for access to the internal local function variables.
E.g.
function update() {
local -i VAR=45
local -i TOPSECRET_NUMBER=50
On 3/22/16 10:47 AM, Adam Danischewski wrote:
> I noticed an issue using the parameter built-in variable $@ breaking
> out of contained strings when utilized in functions.
>
> For example, consider the following bash script: m.bsh
> #!/bin/bash
> echo "$#"
> while getopts d: OPTION "$@"; do
> cas
I hit send by accident, disregard the first part - I had the info page open
and didn't realize I had sent the email already, the "$*" is what I should
be using.
The second part is still of a mystery, again a quick typo where it states
VAR2=2, it should read VAR2=3 to obtain 47.
On Tue, Mar 22, 20
> Am 22.03.2016 um 15:47 schrieb Adam Danischewski
> :
>
> I noticed an issue using the parameter built-in variable $@ breaking
> out of contained strings when utilized in functions.
>
> For example, consider the following bash script: m.bsh
> #!/bin/bash
> echo "$#"
> while getopts d: OPTION
I noticed an issue using the parameter built-in variable $@ breaking
out of contained strings when utilized in functions.
For example, consider the following bash script: m.bsh
#!/bin/bash
echo "$#"
while getopts d: OPTION "$@"; do
case "$OPTION" in
d)
echo "the optarg is ${OPTARG##*=}, o