problem exporting result of awk to an array...
cmd=$1 # first argument
str=( $2 ) # second argument pattern=$3 # third argument for (( i=0 ; i<${#str[*]} ; i=i+1 )) do echo ${str[${i}]}|awk -F $pattern '{print NF-1}' var[${i}]=`${str[${i}]}|awk -F $pattern '{print NF-1}' done echo ${var[*]} when i do : :~/Desktop$ ./tst.sh -r 'asdasd asdasd' asd the result is 2 2 ----------------------------------------------- the var stills empty :/... can somebody help me :/ i am to noob :/ |
You have a space between the hyphen and the F argument, no closing single quote in the first awk line, and no third argument to use as the separator.
|
Quote:
about the third, the third argument isn't the asd? 1st -r 2nd asdasd asdasd 3rd asd thx |
All times are GMT -5. The time now is 12:01 PM. |