penguin/utils

my env utils

commit ccc77357293a81f0ed34c5fc574568023c24fa6b

author斟酌 鵬兄 <tgckpg@gmail.com>
date2017-08-23T17:00:59Z
subjectRenew bat file when location changed
commit ccc77357293a81f0ed34c5fc574568023c24fa6b
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2017-08-23T17:00:59Z

    Renew bat file when location changed
---
 bash/bashrc/sources/10_aliases | 3 +++
 bash/bashrc/sources/11_vs_env  | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/bash/bashrc/sources/10_aliases b/bash/bashrc/sources/10_aliases
index d7b1208..3879791 100755
--- a/bash/bashrc/sources/10_aliases
+++ b/bash/bashrc/sources/10_aliases
@@ -35,3 +35,6 @@ alias wget='wget --directory-prefix="$HOME/Downloads"'
 
 # ssh-agent key lifetime
 alias ssh-add="ssh-add -t 43200"
+
+# Pretty print sqlite3
+alias sqlite3="sqlite3 -header -column"
diff --git a/bash/bashrc/sources/11_vs_env b/bash/bashrc/sources/11_vs_env
index 1b361bc..6329f76 100755
--- a/bash/bashrc/sources/11_vs_env
+++ b/bash/bashrc/sources/11_vs_env
@@ -22,7 +22,10 @@ function vsshell {
 }
 
 if [ -f "$VS_SHELL_BAT" ]; then
-	return
+	_PATH=$( cygpath "$( grep -o "^@REM FILE_PATH: .\+" "$VS_SHELL_BAT" | cut -c 17- )" )
+	if [ -f "$_PATH" ]; then
+		return
+	fi
 fi
 
 START_MENU="$( cygpath $ProgramData )/Microsoft/Windows/Start Menu/"
@@ -30,5 +33,6 @@ START_MENU="$( cygpath $ProgramData )/Microsoft/Windows/Start Menu/"
 _PATH=$( find "$START_MENU" -name "*Command Prompt*" | grep "Visual Studio" | grep x64 | grep Native | xargs -I % readshortcut % -r | grep -o "\"\([^\"]\+\)\"" )
 
 echo "@echo off" > "$VS_SHELL_BAT"
+echo "@REM FILE_PATH: ${_PATH:1:-1}" >> "$VS_SHELL_BAT"
 echo "CALL $_PATH" >> "$VS_SHELL_BAT"
 echo "START $( where mintty ) -i /Cygwin-Terminal.ico -" >> "$VS_SHELL_BAT"