I am working on a simple script that checks if there is .vimrc file and what is configured in that file:
if [ "$(ls -a /root | grep .vimrc)" = ".vimrc" ]; then
echo "The .vimrc file exists"
if [ "$(cat /root/.vimrc | grep "colorscheme desert")" = "colorscheme desert" ]; then
echo "colorscheme is already added in the .vimrc file"
else
echo "The file does not have colorscheme added"
fi
The first if statement is working fine, I get .vimrc = .vimrc
thus echo "The .vimrc file exists"
But, the second if statement just prints "The file does not have colorscheme added", but if I check that file, it has that part added:
cat /root/.vimrc | grep "colorscheme desert"
colorscheme desert
Thank you in advance!