scripts

My personal collection of scripts
git clone git://src.gearsix.net/scripts
Log | Files | Refs | Atom | README | LICENSE

commit 8c950014e6447021fcce252864ed8e3f31dee3e7
parent 40b6dbdec1a1f335582f295280d25e17fdf62358
Author: GeaRSiX <gearsix@tuta.io>
Date:   Mon, 12 Nov 2018 23:33:24 +0000

📚 updated documentation in all files

Diffstat:
Mcpc.sh | 3++-
Mflac2mp3.sh | 8+++++---
Mgfind.sh | 3++-
Mmkdcp.sh | 5+++--
Mmkdmv.sh | 3++-
Mmkdnvim.sh | 3++-
Mopenurl.sh | 8+++++---
Mstrindex.sh | 3++-
Mstrlen.sh | 10+++++-----
Mxopen.sh | 4+---
10 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/cpc.sh b/cpc.sh @@ -1,6 +1,7 @@ #!/bin/bash -# ~/scripts/cpc.sh +# cpc (cp contents) # copies the contents of file $1 to file $2 +# # e.g.$ cpc file1.txt file2.txt touch $2 diff --git a/flac2mp3.sh b/flac2mp3.sh @@ -1,7 +1,9 @@ #!/bin/bash -# ~/scripts/flac2mp3.sh -# converts .flac to .mp3 -# DEPENDENCIES: ffmpeg +# flac2mp3 +# converts .flac files ($1...$n) to .mp3 files +# +# DEPENDENCIES: +# ffmpeg # # e.g.$ flac2mp3 ./album diff --git a/gfind.sh b/gfind.sh @@ -1,6 +1,7 @@ #!/bin/bash -# ~/scripts +# gfind (grep find) # find files containing string $2 in directory/file $1 +# # e.g.$ gfind dogs/ "shades" grep -rnw $1 -e $2 #recursive, print line #, match whole word diff --git a/mkdcp.sh b/mkdcp.sh @@ -1,7 +1,8 @@ #!/bin/bash -# ~/scripts +# mkdcp (mkdir&cp) # make a directory and copy files into it -# e.g.$ mkdcp ~/new-dir ~/var/tmp/file1 ~/var/tmp/file2 ... +# +# e.g.$ mkdcp ~/new-dir /tmp/file* #mkdir $1 dir=$1; diff --git a/mkdmv.sh b/mkdmv.sh @@ -1,6 +1,7 @@ #!/bin/bash -# ~/scripts +# mkdmv (mkdir&mv) # make directory $1 and move files ($2...$n) into it +# # e.g.$ mkdmv ~/new-dir ~/var/tmp/file* #mkdir $1 diff --git a/mkdnvim.sh b/mkdnvim.sh @@ -1,5 +1,5 @@ #!/bin/bash -# ~/scripts +# mkdnvim (mkdir&nvim) # Makes directory $1 and opens file $2 using nvim # # mkdnvim <new_dir> <filename> @@ -9,3 +9,4 @@ mkdir $1; cd $1; touch $2; nvim $2; + diff --git a/openurl.sh b/openurl.sh @@ -1,8 +1,10 @@ #!/bin/bash -# ~/scripts -# script for opening .url files +# openurl +# script for opening .url filetype +# # e.g.$ openurl link.url -# http://www.danielbrice.net/blog/opening-url-file-like-a-pro/ +# +# SEE: http://www.danielbrice.net/blog/opening-url-file-like-a-pro/ URL=$(cat "$1" | grep "URL=" | cut -d= -f2) echo -e "xdg-open $URL" diff --git a/strindex.sh b/strindex.sh @@ -1,7 +1,8 @@ #!/bin/bash -# ~/scripts +# strindex (string index) # finds the starting index of a substring in a string # index returned ranges from 0 - (string length) +# # e.g.$ strindex "cat" "the cat sat on the mat" #returns 4 #swaps argument (strindex "cat on mat" "mat") diff --git a/strlen.sh b/strlen.sh @@ -1,7 +1,10 @@ #!/bin/bash -# ~/scripts +# strlen (string length) # echo's the length of a string -# e.g.$ strlen "my di-" +# +# e.g.$ strlen "ma di-" +# +# SEE: https://stackoverflow.com/questions/17368067/length-of-string-in-bash strU8DiffLen () { local bytlen oLang=$LANG oLcAll=$LC_ALL @@ -17,6 +20,3 @@ for string in $1; do "'$string'" ${#string} $((${#string}+$?)) done -#string=$1 -#length=${#string} -#echo "$length" diff --git a/xopen.sh b/xopen.sh @@ -1,13 +1,11 @@ #!/bin/bash -# ~/scripts +# xdg-open # open file in xserver (doesn't support multiple files at once) # # xopen file [-shh, -shhh] # -shh, -shhh # send stdout to /dev/null # # $lazymode=xo -# -# @TODO add autocomplete for last_arg; do true; done; # check for shhh