bash
last update:
2020/12/19
exsample (zipper)
$ echo $PATH // /usr/local/bin / check $PATH $ vi /usr/local/bin/zipper // make file (no extension) // code of zipper #!/bin/bash project=$(basename `pwd`) export=~/Desktop/ rm -r $export${project} mkdir $export${project} for d in $( ls -a . ); do if [ ${d} == "." ] || [ ${d} == ".." ] || [ ${d} == ".git" ] || [ ${d} == ".sass-cache" ] || [ ${d} == "node_modules" ] ; then echo "not cp " ${d} else cp -r ../${project}/${d} $export${project} fi done cd $export${project} clean=(".DS_Store" "npm-debug.log") for c in ${clean[@]}; do find $export${project} -name ${c} -print -exec rm {} ";" done cd $export zip -r ${project}_`date +%y%m%d_%H%M`.zip ${project} echo "done" exit 0 code_popup $ chmod +x /usr/local/bin/zipper // giving of execution permission $ zipper // run at project root
exsample (putter)
$ echo $PATH // /usr/local/bin / check $PATH $ vi /usr/local/bin/putter // make file (no extension) // code of putter #!/bin/bash export={workspace}/3300/html/sample/_temp raw={workspace}/temp_npm rm $export/temp_npm.zip mkdir $export/temp_npm cd $raw for d in $( ls -a . ); do if [ ${d} == "." ] || [ ${d} == ".." ] || [ ${d} == ".DS_Store" ] || [ ${d} == ".git" ] || [ ${d} == ".sass-cache" ] || [ ${d} == "node_modules" ] ; then echo "not cp " ${d} else cp -r $raw/${d} $export/temp_npm echo "cp " ${d} fi done rm -r $export/temp_npm/base64/make rm $export/temp_npm/dest/* rm -r $export/temp_npm/img/make rm -r $export/temp_npm/img_org/make rm $export/temp_npm/package-lock.json rm -r $export/temp_npm/sass/make cd $export zip -r temp_npm.zip temp_npm rm -r temp_npm echo "done" exit 0 code_popup $ chmod +x /usr/local/bin/putter // giving of execution permission $ putter // run at anywhere
exsample (retab)
$ echo $PATH // /usr/local/bin / check $PATH $ vi /usr/local/bin/retab // make file (no extension) // code of retab #!/bin/bash for file in `find . -type d \( -name .git -o -name dest -o -name dist -o -name node_modules \) -prune -o -type f \( -name \*.js -o -name \*.json -o -name \*.scss -o -name \*.html -o -name \*.php -o -name \*.sh -o -name .eslintrc \) -print`; do echo $file expand -t2 ${file} > ${file}.$$ rm -f ${file} mv -f ${file}.$$ ${file} done exit 0 code_popup $ chmod +x /usr/local/bin/retab // giving of execution permission $ retab // run at project root
exsample (tn)
$ echo $PATH // /usr/local/bin / check $PATH $ vi /usr/local/bin/tn // make file (no extension) // code of tn #!/bin/bash build=$1 exist="./*" for name in $exist; do if [ $1 == ${name##.\/} ]; then echo "That name already exists." exit 1 elif [ -z $1 ]; then echo "Project name is not specified." exit 1 fi done git clone {bare repository} $1 cd $1 rm -rf .git npm install npm run i && npm run l exit 0 code_popup $ chmod +x /usr/local/bin/tn // giving of execution permission $ tn {project name} // run at workspace root
exsample (phpserve)
$ echo $PATH // /usr/local/bin / check $PATH $ vi /usr/local/bin/phpserve // make file (no extension) // code of phpserve #!/bin/bash php -S 127.0.0.1:8888 -t={workspace} exit 0 code_popup $ chmod +x /usr/local/bin/phpserve // giving of execution permission $ phpserve // run anywhere