setup.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. # Quick Script to setup terminal environment
  3. # Set Permissions
  4. chmod 660 ./*
  5. chmod 660 "$HOME/.bashrc"
  6. chmod 770 "$HOME/dots"
  7. function add_string_to_file() {
  8. # Checks if a string is in a file
  9. # adds it if it isn't in that file
  10. local file="$1"
  11. local string="$2"
  12. if ! grep -q "$string" "$file"; then
  13. echo "$string" >> "$file"
  14. fi
  15. }
  16. # Bashrc
  17. add_string_to_file "$HOME/.bashrc" "# Setup Aliases"
  18. add_string_to_file "$HOME/.bashrc" "source $HOME/dots/aliases" && source "$HOME/.bashrc"
  19. add_string_to_file "$HOME/.bashrc" "source $HOME/dots/seafly-prompt" && source "$HOME/.bashrc"
  20. add_string_to_file "$HOME/.bashrc" "# Scripts"
  21. add_string_to_file "$HOME/.bashrc" "bash $HOME/dots/life.sh 1993-07-21 control" && source "$HOME/.bashrc"
  22. # NVIM
  23. mkdir -p "$HOME/.config/nvim/"
  24. cp "./nvim" "$HOME/.config/nvim/init.vim"
  25. # TMUX
  26. cp "./tmux.conf" "$HOME/.tmux.conf"
  27. # PATH VARS
  28. if [ -f "$HOME/.user_paths" ]; then
  29. chmod 660 "$HOME/.user_paths"
  30. add_string_to_file "$HOME/.bashrc" "# PATH FILE"
  31. add_string_to_file "$HOME/.bashrc" "source $HOME/.user_paths" && source "$HOME/.bashrc"
  32. fi