dreamsparkx
9/8/2017 - 5:42 PM

Configure Terminal for simplicity

Configure Terminal for simplicity

if [ -f ~/.bashrc ];
then
	source ~/.bashrc
fi
. ~/bin/dotfiles/bashrc
. ~/bin/dotfiles/bash/env
. ~/bin/dotfiles/bash/config
. ~/bin/dotfiles/bash/aliases
PATH=$PATH:~/bin/scripts
PATH=/usr/local/sbin:$PATH
#!/bin/bash
#is there an argument
if [[ ! $1 ]]; then
	echo "Missing argument"
	echo "create_scripts filename"
	exit 1
fi
scriptname=$1
bindir="${HOME}/bin/scripts"
filename="${bindir}/${scriptname}"
if [[ -e $filename ]]; then
	echo "File ${filename} already exists"
	exit 1
fi
if type "$scriptname"; then
	echo "There is already a command with name ${scriptname}"
	exit 1
fi
if [[ ! -d $bindir ]]; then
	if mkdir "$bindir"; then
		echo "created ${bindir}"
	else
		echo "Could not create ${bindir}."
		exit 1
	fi
fi
echo '#!/bin/bash' >> "$filename"
chmod u+x "$filename"
echo "Enter Option:"
echo "1. Edit with Brackets"
echo "2. Edit with Atom"
echo "3. Edit with Sublime Text"
echo "4. Edit Later"
echo "Enter Option:"
read op
if [[ op -eq "1" ]]; then
	brackets "$filename"
elif [[ op -eq "2" ]]; then
	atom "$filename"
elif [[ op -eq "3" ]]; then
	sublimeAdmin "$filename"
elif [[ op -eq "4" ]]; then
	exit 0
else
	exit 0
fi
#if [[ $EDITOR ]]; then
#	$EDITOR "$filename"
#else
#	echo "Script created; not starting editor because \$EDITOR is not set."
#fi
#alias sublimeAdmin="sudo /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text "

Create a bin folder: with dofiles and scripts

bin
├── apache_settings
│   ├── apache_config.txt
│   └── httpd.conf.pre-update
├── dotfiles
│   ├── bash
│   │   ├── aliases
│   │   ├── config
│   │   └── env
│   ├── bashrc
│   └── diffdate2.py
├── mysql
│   └── mysql_coinfig.txt
├── nginx_settings
│   ├── nginx.conf.default
│   └── nginx_settings.txt
└── scripts
    ├── create_scripts
    ├── downloadFile
    └── tn