linux command wrap

$ cat tmux-attach

1 if [ -z $1 ] ; then
2    tmux ls
3 else
4    tmux attach -t $1
5 fi

 

$ cat /usr/bin/cscope-go.sh

 1 #!/bin/bash
 2 
 3 # generate cscope index files in current directory
 4 # the generated cscope index files also include go standard packages
 5 
 6 if [ "$GOROOT" = "" ] ; then
 7 echo "GOROOT is not set"
 8 GOROOT=`go env |grep "GOROOT" |cut -d "=" -f2`
 9 GOROOT=${GOROOT#\"}
10 GOROOT=${GOROOT%\"}
11 fi
12 echo $GOROOT
13 
14 go_pkg_src=$GOROOT/pkg
15 
16 find $go_pkg_src -name "*.go" -print > cscope.files
17 find . -name "*.go" -print >> cscope.files
18 
19 if cscope -b -k; then
20         echo "Done"
21 else
22         echo "Failed"
23         exit 1
24 fi

 

gopath.sh

1 GOROOT=`go env |grep "GOROOT" |cut -d "=" -f2`
2 GOROOT=${GOROOT#\"}
3 GOROOT=${GOROOT%\"}
4 echo $GOROOT
5 
6 GOPATH=`go env |grep GOPATH |cut -d "=" -f 2`
7 GOPATH=${GOPATH%\"}
8 GOPATH=${GOPATH#\"}
9 echo $GOPATH
10 declare -x GOROOT
11 declare -x GOPATH
12 export PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin

 

posted @ 2017-08-20 00:56  lvmxh  阅读(303)  评论(0编辑  收藏  举报