scripts

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

commit 394bd2b3bd1eea392d0a7f0c50f4eb5058d7897b
parent 3fa4e9356877efa438db87f9442656a3efc389a0
Author: GeaRSiX <gearsix@tuta.io>
Date:   Wed, 15 Jan 2020 20:14:31 +0000

moved scripts from bash->sh

Diffstat:
Msrc/cpc.sh | 2+-
Msrc/depreciated/touchn.sh | 2+-
Msrc/flac2mp3.sh | 2+-
Msrc/gfind.sh | 2+-
Msrc/mkdcp.sh | 2+-
Msrc/mkdmv.sh | 2+-
Msrc/mkdnvim.sh | 2+-
Msrc/openurl.sh | 2+-
Msrc/shh.sh | 2+-
Msrc/strindex.sh | 2+-
Msrc/strlen.sh | 6+++---
Msrc/while-true.sh | 8++++----
Msrc/xopen.sh | 2+-
13 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/cpc.sh b/src/cpc.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # cpc (cp contents) # description: copies the contents of file $1 to file $2 # diff --git a/src/depreciated/touchn.sh b/src/depreciated/touchn.sh @@ -1,6 +1,6 @@ # DEPRECIATED: found out you could just use "touch ./file{0..13}" -#!/bin/bash +#!/bin/sh # ~/scripts # description: create $2 files name $1 appended with 1 to $2 # e.g$ touchn "song" 13 # creates song1...song13 in curr_dir diff --git a/src/flac2mp3.sh b/src/flac2mp3.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # flac2mp3 # description: converts .flac files ($1...$n) to .mp3 files # e.g.$ flac2mp3 ./album diff --git a/src/gfind.sh b/src/gfind.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # gfind (grep find) # description: find files containing string $2 in directory/file $1 # e.g.$ gfind dogs/ "shades" diff --git a/src/mkdcp.sh b/src/mkdcp.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # mkdcp (mkdir&cp) # description: make a directory and copy files into it # e.g.$ mkdcp ~/new-dir /tmp/file* diff --git a/src/mkdmv.sh b/src/mkdmv.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # mkdmv (mkdir & mv) # description: mkdir $1 && mv ($2...$n) 1to it # e.g.$ mkdmv ~/new-dir ~/var/tmp/file* diff --git a/src/mkdnvim.sh b/src/mkdnvim.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # mkdnvim (mkdir&nvim) # description: makes directory $1 and opens file $2 using nvim # e.g.$ mkdnvim ~/new file #creates ~/new/file and nvim into it diff --git a/src/openurl.sh b/src/openurl.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # openurl # description: script for opening .url filetype # e.g.$ openurl link.url diff --git a/src/shh.sh b/src/shh.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # shh = quiet for commands that don't include it # description: run a terminal command ($@) and send stdout to /dev/null # e.g.$ shh chromium & diff --git a/src/strindex.sh b/src/strindex.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # strindex (string index) # description: finds the starting index of substring ($1) in a string ($2) # e.g.$ strindex "cat" "the cat sat on the mat" #returns 4 diff --git a/src/strlen.sh b/src/strlen.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # strlen (string length) # description: echo's the length of a string ($1) # e.g.$ strlen "ma di-" @@ -13,9 +13,9 @@ strU8DiffLen () { return $(( bytlen - ${#1} )) } -for string in $1; do +for string in $@; do strU8DiffLen "$string" - printf " - %-$((14+$?))s is %2d chars length, but use %2d bytes\n" \ + printf "%-$((14+$?))s is %2d chars length and uses %2d bytes\n" \ "'$string'" ${#string} $((${#string}+$?)) done diff --git a/src/while-true.sh b/src/while-true.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # while-true # description: clear terminal, run $1, sleep ($2 || 1), repeat (Ctrl+C to cancel) # e.g.$ while-true "git-status" 5 @@ -6,9 +6,9 @@ while [ true ]; do clear $1 - if [[ -z $2 ]]; then - sleep 1 - else + if [[ -e $2 ]]; then sleep $2 + else + sleep 1 fi done diff --git a/src/xopen.sh b/src/xopen.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # xopen = xdg-open FILE # description: open file in xserver (doesn't support multiple files at once yet) # ARGUMENTS: -q, --quiet send stdout to /dev/null