On centos 7 I have this weird behavior:
If I do:
grep -v "^#" /etc/security/limits.conf
I have:
* soft nofile 10000
* hard nofile 10000
if I do:
var=$(grep -v "^#" /etc/security/limits.conf)
echo $var
I have the results is the grep result plus the files in my working directory. for example, if I am in /usr I have:
bin etc games include lib lib64 libexec local sbin share src tmp soft nofile 10000 bin etc games include lib lib64 libexec local sbin share src tmp hard nofile 10000
This only happens with -v option. What I'm missing?