# rc.conf + rc Script ==> get all related vars



## Leander (Apr 29, 2012)

Hi there,

I want to write a rc script. My rc.conf should hold information for it in following format:


```
md_enable="YES"
md_file_md0="/path/to/file-0"
md_file_md1="/path/to/file-1"
md_file_md2="/path/to/file-2"
```

Now I want something like this in my rc start script to find out about all "md_file_md" related variables:


```
for FILE in $md_file_md*; do
    echo $FILE
done
```

Obviuosly I could write something by the help of sed / awk to filter for md0, md1, md2, md[n] in rc.conf file ... but I was hoping the rc framework has somthing like this already? Or is there any better ideas of how to solve this easier?

Thanks


----------



## graudeejs (Apr 29, 2012)

Why not to set

```
md_files="/path/to/file-0 /path/to/file-1 /path/to/file-2"
```
?


----------



## Leander (Apr 29, 2012)

graudeejs said:
			
		

> Why not to set
> 
> ```
> md_files="/path/to/file-0 /path/to/file-1 /path/to/file-2"
> ...



Thanks for your input. I thought about such a solution already but the issue is that this method would not relate md dev number with file definition ... So it is not really usable for my needs.


----------



## Leander (Apr 29, 2012)

FYI: http://forums.freebsd.org/showthread.php?p=175540#post175540


----------

