Search Results

Search: Posts Made By: timmyyyyy
Forum: Programming 02-17-2012
7,469
Posted By Corona688
You create the pipe after you fork. The pipe the...
You create the pipe after you fork. The pipe the child gets, and the pipe the parent gets, are created independently hence not the same pipe. There will be no communication between parent and...
2,246
Posted By Corona688
Why are you putting 'echo' in there? It's not...
Why are you putting 'echo' in there? It's not necessary. I just used 'echo' as an example -- the positional parameter gets fed into echo instead of the number itself.

When I say $((N+2)), I...
2,246
Posted By jim mcnamara
For anyone reading Corona's code and not knowing...
For anyone reading Corona's code and not knowing bash's ${!pattern}:
${!N} uses the ! pattern matching operator that expands to any variable with the
same name as the value of the variable, in...
2,246
Posted By Corona688
It's best to avoid eval if at all possible. If...
It's best to avoid eval if at all possible. If you don't consider its implications very carefully, it can be used to inject arbitrary code inside your program.

You can't directly substitute into...
2,246
Posted By jim mcnamara
or array (bash example) #!/bin/bash ...
or array (bash example)

#!/bin/bash
#example usage: ./thisfile.shl 1 2 3
echo "Parameters are $@"
declare -a parms=("$@")
i=2
echo ${parms[i]}
2,246
Posted By CarloM
You could use eval. For example: # cat x.sh ...
You could use eval. For example:
# cat x.sh
#!/bin/ksh
z=1
x=$(( $z + 2 ))
y=$(eval echo \${${x}})
echo $y
# ./x.sh 1111 2222 3333
3333
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 11:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy