Initial commit.

This commit is contained in:
yan
2011-11-17 15:45:33 -06:00
commit 882015bc6d
1819 changed files with 111625 additions and 0 deletions

1
vim/snippets/sh/#!.snippet Executable file
View File

@@ -0,0 +1 @@
#!/bin/bash

6
vim/snippets/sh/$#.snippet Executable file
View File

@@ -0,0 +1,6 @@
if [ $# -lt 1 ]; then
echo "${1:#missing arguments}"
exit 1
else
${2:#action}
fi

0
vim/snippets/sh/arr.snippet Executable file
View File

View File

@@ -0,0 +1,4 @@
${1:array}[0]=${2:value}
$1[1]=${3:value}
$1[2]=${4:value}
${5}

View File

@@ -0,0 +1 @@
${1:array}=(${2:first} ${3:second} ${4}) ${5}

4
vim/snippets/sh/case.snippet Executable file
View File

@@ -0,0 +1,4 @@
case ${1:word} in
${2:pattern})
${3};;
esac

1
vim/snippets/sh/date.snippet Executable file
View File

@@ -0,0 +1 @@
`system("date +%m-%d-%Y")`

2
vim/snippets/sh/elif.snippet Executable file
View File

@@ -0,0 +1,2 @@
elif [[ ${1:condition} ]]; then
${2:#statements}

View File

@@ -0,0 +1,4 @@
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${3:#statements}
done

View File

@@ -0,0 +1,4 @@
for ${1:i} in ${!${2:Array}[@]}
do
echo "${$2[$1]}"
done

View File

@@ -0,0 +1,3 @@
for ${1:var} in $${2:list}; do
echo "$$1"
done

View File

@@ -0,0 +1,5 @@
numargs=$#
for ((i=1 ; i <= numargs ; i++)); do
echo "$1"
shift
done

View File

@@ -0,0 +1,4 @@
for ${1:i} in {${2:1}..${3:10}}
do
echo "$$1"
done

4
vim/snippets/sh/fore.snippet Executable file
View File

@@ -0,0 +1,4 @@
for ${2:i} in ${1:array}
do
echo $2
done

3
vim/snippets/sh/fun.snippet Executable file
View File

@@ -0,0 +1,3 @@
function ${1:name}(){
${2:Commands}
}

5
vim/snippets/sh/gt.snippet Executable file
View File

@@ -0,0 +1,5 @@
if [ ${1:$var} -gt ${2:$other} ]; then
echo 'Greater than $2'
else
echo 'Less than $2'
fi

3
vim/snippets/sh/if.snippet Executable file
View File

@@ -0,0 +1,3 @@
if [[ ${1:condition} ]]; then
${2:#statements}
fi

1
vim/snippets/sh/ifdir.snippet Executable file
View File

@@ -0,0 +1 @@
[ -d ${1:namedir} ] || mkdir $1 ; cd $1

5
vim/snippets/sh/ife.snippet Executable file
View File

@@ -0,0 +1,5 @@
if [[ ${1:condition} ]]; then
${2:#statements}
else
${3:#statements}
fi

4
vim/snippets/sh/iffile.snippet Executable file
View File

@@ -0,0 +1,4 @@
if [ ! -e ${1:filename} ]; then
echo "file $1 not present"
fi

7
vim/snippets/sh/ifroot.snippet Executable file
View File

@@ -0,0 +1,7 @@
# Need to be logged in as root
if [ "$(id -u)" != "0" ]; then
echo " Need be root"
sleep 2
exit 1
fi

5
vim/snippets/sh/lt.snippet Executable file
View File

@@ -0,0 +1,5 @@
if [ ${1:$var} -lt ${2:$other} ]; then
echo 'Less than $2'
else
echo 'Greater than $2'
fi

8
vim/snippets/sh/sh.snippet Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
# Created on: `system("date +%m-%d-%Y")`
# Last Change: `system("date +%m-%d-%Y")`
# vim:ft=sh:fdm=syntax:nu:
# Description: ${1:description}
# Author: ${2:`system("whoami")`}
# Url: ${3:url}

5
vim/snippets/sh/usage.snippet Executable file
View File

@@ -0,0 +1,5 @@
usage()
{
echo "Usage: $(basename $${1:0}) ${2:argument}"
echo "${3:explanation}"
}

3
vim/snippets/sh/while.snippet Executable file
View File

@@ -0,0 +1,3 @@
while [[ ${1:condition} ]]; do
${2:#statements}
done

View File

@@ -0,0 +1,5 @@
echo -n "Do you wish to ${1:#question}" '[y/n] ' ; read ${2:ans}
case "$$2" in
y*|Y*) ${3:#statement} ;;
*) ${4:#statement};;
esac

View File

@@ -0,0 +1,6 @@
read ${1:yn}
if [[ $$1 =~ [Yy] ]]; then
echo "${2:#statement}"
else
echo "${3:#statement}"
fi