Concatenando variável de string dentro de um loop for no shell bash [closed]

10
#!/bin/bash

names= find /home/devuser -name 'BI*'
echo $names

for name in {names[@]}
do    
 echo $name
 $var = $var$name   
done

echo $var
    
por jagan 17.12.2013 / 09:59

2 respostas

14

#!/bin/bash

names= find /home/devuser -name 'BI*'
echo $names

for name in {names[@]}
do    
 echo $name
 var=$var$name //$ should be removed which is prefixed before var. Blank space before and after equal sign should be removed to run this code.   
done

echo $var

Espero que ajude!

    
por 17.12.2013 / 10:24
2

Alterar

$var = $var$name   

para

var=$var$name   
    
por 17.12.2013 / 10:37