#!/bin/bash echo "==================================================================================" echo "Script to force enable color prompt on Ubuntu and other Linux distros. ..." #!/bin/bash # Get the path for the .bashrc file from the prompt or set it as being in the users home dir. BASHRC="${1:=~/.bashrc}" # Use sed to remove the comment from the force color line in the .bashrc file. sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/g' $BASHRC # BONUS: Uncomment to change the default color of the prompt. #sed -i 's/1;32m/1;31m/g' # Reload the .bashrc file source BASHRC echo "Done..." echo "==================================================================================" echo "==================================================================================" echo "If not create them manually:..." mkdir /var/www/html/drush mkdir /var/www/html/drush/sites cd /var/www/html/drush/sites echo "Done..." echo "==================================================================================" echo "==================================================================================" echo "nano /var/www/html/drush/sites/dev.site.yml..." dev: paths: modules: modules theme: themes/herc root: /var/www/html/web uri: herc.ddev.site echo "Done..." echo "==================================================================================" echo "==================================================================================" echo "nano /var/www/html/drush/sites/prod.site.yml..." prod: host: 216.218.184.100 options: command-specific: sql-sync: sanitize: true no-ordered-dump: true structure-tables: common: - cache - cache_filter - cache_menu - cache_page - history - sessions - watchdog source-command-specific: sql-sync: no-cache: true structure-tables-key: common paths: modules: modules theme: themes/herc root: /home/herc/public_html/web uri: herc.altagrade.net user: herc ssh: options: '-p 19753' echo "Done..." echo "==================================================================================" echo "==================================================================================" echo "nano ~/.bash_aliases..." function pull-db() { cd /var/www/docroot drush -y sql-sync @prod @dev drush uli 1 } alias pull-theme='drush -y rsync @prod:%theme @dev:%theme' alias pull-cmodules='drush -y rsync @prod:%modules @dev:%modules' alias pull-files='drush -y rsync @prod:%files @dev:%files' alias pull-all='drush -y rsync --exclude-conf @prod @dev' alias push-theme='drush -y rsync @dev:%theme @prod:%theme' alias push-modules='drush -y rsync @dev:%custom @prod:%modules' alias eba='nano ~/.bash_aliases' alias lba='source ~/.bash_aliases' alias ?='history' # DISPLAYS HISTORY alias x='exit' alias yum='yum -y' alias recall="history |grep $1" tardir () { tar cvzf ${1}.tgz ${1} } # Extract compressed file extract () { if [ -f $1 ] && [ -r $1 ] ; then case $1 in (*.tar.bz|*.tbz) tar -xjf $1;; (*.tar.bz2|*.tbz2) tar xjf $1;; (*.tar.gz|*.tgz) tar xzf $1;; (*.bz2) bunzip2 $1;; (*.rar) rar x $1;; (*.gz) gunzip $1;; (*.tar) tar xf $1;; (*.zip) unzip $1;; (*.Z) uncompress $1;; (*.7z) 7z x $1;; (*.deb) sudo dpkg -i $1;; (*.rpm) sudo alien -dik $1;; (*) echo "extract: unsupported format $1" ;; esac rm -rf $1 ls -l else echo "extract: file not found or unreadable: $1" fi } # Find a file with a pattern in file name function fn() { find . -type f -iname '*'$1'*' -ls ; } # Find a file with a pattern in the content of the file function fs() { grep -Ril "$1" .; } echo "Done..." echo "==================================================================================" echo "==================================================================================" echo "Generate public key and copy it to remote server...." ssh-keygen cat ~/.ssh/id_rsa.pub echo "Done..." echo "==================================================================================" exit