Files
42header/set_header.sh
2021-10-29 08:30:44 +02:00

35 lines
679 B
Bash
Executable File

#!/bin/bash
# ./set_header.sh
# Set variables
if [ -f "~/.zshrc" ]
then
if ! grep -q ' USER=' "~/.zshrc" ] && [ -z "$USER" ]
then
echo 'export USER=`whoami`' >> ~/.zshrc
fi
if ! grep -q ' MAIL=' "~/.zshrc" ]
then
echo 'export MAIL="${USER}@student.42lausanne.ch"' >> ~/.zshrc
fi
fi
if [ -f "~/.bashrc" ]
then
if ! grep -q ' USER=' "~/.bashrc" ] && [ -z "$USER" ]
then
echo 'export USER=`whoami`' >> ~/.bashrc
fi
if ! grep -q ' MAIL=' "~/.bashrc" ]
then
echo 'export MAIL="${USER}@student.42lausanne.ch"' >> ~/.bashrc
fi
fi
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
# Add stdheader to vim plugins
cp vim/stdheader.vim ~/.vim/plugin/
source ~/.zshrc