Compare commits

...

2 Commits

36 changed files with 206 additions and 104 deletions

View File

@ -14,5 +14,5 @@ else
fi
export ALT_PATH="${PATH}"
for directory in $(ls --file-type "$DIR" | grep '/' | sed 's/\///') ; do
export PATH="${PATH}:$(absolutedir $DIR/$directory)"
export PATH="$(absolutedir $DIR/$directory):${PATH}"
done

View File

@ -1,8 +1,11 @@
#!/bin/sh
# If the first argument is a valid command, executes it with the supplied arguments. If not, executes cat.
NAME="$(filename $0)"
USAGE="Usage: $NAME [command] [args ...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command] [args ...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ "$1" != "" ] ; then
type "$1" 2>/dev/null 1>/dev/null

View File

@ -1,8 +1,11 @@
#!/bin/sh
# echoes the parent PID, then runs cat.
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
echo $$
cat

View File

@ -3,9 +3,12 @@
# Requires: <program> <package (Devuan)>
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: <command, args...> | $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: <command, args...> | $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
IFS='
'

View File

@ -1,9 +1,12 @@
#!/bin/sh
# If the first argument is a valid command, executes it with the supplied arguments. If not, executes cat.
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ "$1" != "" ] ; then
type "$1" 2>/dev/null 1>/dev/null

View File

@ -5,9 +5,12 @@
# It uses the script 'tmpfifo' to create FIFOs.
# Modify tmpfifo or replace it to change default location and naming convention.
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
Fifork () {
TMPFIFO="$1"

View File

@ -8,9 +8,12 @@ lastarg () {
}
IFS='/'
NAME="$(lastarg $0)"
USAGE="Usage: $NAME [filenames...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(lastarg $0)"
USAGE="Usage: $NAME [filenames...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
for item in "$@" ; do
echo "$(lastarg $item)"

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Takes the first argument, injects it in the nth position and runs the result. If the argument or position is not available, returns 1.
NAME="$(filename $0)"
USAGE="Usage: $NAME [arg] [position] <command> [args ...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [arg] [position] <command> [args ...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
IFS='
'

View File

@ -4,9 +4,12 @@
# cat coreutils
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: $NAME <number of args to pipe> <args...> [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME <number of args to pipe> <args...> [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if isnum "$1" ; then
POSITION="$1"

View File

@ -4,9 +4,12 @@
# cat coreutils
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: $NAME <argument to pipe> [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME <argument to pipe> [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
IFS='
'

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Echoes the exit code for an arbitrary command, otherwise returns 0.
NAME="$(filename $0)"
USAGE="Usage: $NAME [command]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
$@
echo "$?"

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Inverts the return status of whatever just ran, or echoes the string and returns 1. Pure eeeevillll.
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
echoordo "$@"
if [ "$?" = "0" ] ; then

View File

@ -5,9 +5,12 @@
# See: https://unix.stackexchange.com/questions/598036/
# Why doesn't test have a check like this..?
NAME="$(filename $0)"
USAGE="Usage: $NAME [number]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [number]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
case "${1#[+-]}" in
(*[!0123456789]*) exit 1 ;;

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Attempts to kill the PID in the first argument and execute a command, otherwise does nothing.
NAME="$(filename $0)"
USAGE="Usage: $NAME [pid] [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [pid] [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if isnum $1 ; then
kill "$1"

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Returns the last argument.
NAME="$(filename $0)"
USAGE="Usage: $NAME [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
for last in "$@" ; do :; done
echo "$last"

View File

@ -4,9 +4,12 @@
# cat coreutils
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...] <argument to pipe>"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...] <argument to pipe>"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
PIPEARG="$(lastarg $@)"
if [ ! "$PIPEARG" = "" ] ; then

View File

@ -4,9 +4,12 @@
# seq coreutils
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: <singular args...> | $NAME <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: <singular args...> | $NAME <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
#IFS='
#'

View File

@ -4,9 +4,12 @@
# seq coreutils
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: <singular args...> | $NAME <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: <singular args...> | $NAME <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
#IFS='
#'

View File

@ -4,9 +4,12 @@
# Requires: <program> <package (Devuan)>
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: <check strings> | $NAME [match string] [command] [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: <check strings> | $NAME [match string] [command] [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ "$1" != "" ] ; then
ARG="$1"

View File

@ -4,9 +4,12 @@
# notify-send libnotify-bin
# sed sed
NAME="$(filename $0)"
USAGE="Usage: [command] | $NAME [notify-send arguments]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: [command] | $NAME [notify-send arguments]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ "$LNOTIFY_PLAYER" = "" ] ; then
LNOTIFY_PLAYER="openmpt123"

View File

@ -5,9 +5,12 @@
# echo coreutils
# cat coreutils
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
ARGS="$@"

View File

@ -1,9 +1,13 @@
#!/bin/sh
# This lets you rotate items in the argument list left by n, and also summons the Antichrist.
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if isnum "$1" ; then
if [ $# -gt 2 ] ; then

View File

@ -1,9 +1,12 @@
#!/bin/sh
# This lets you shift items in the argument list to the right by n.
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if isnum "$1" ; then
if [ $# -gt 2 ] ; then

View File

@ -3,9 +3,12 @@
# Only spawns a certain amount of these processes at a time, determined by the set limit.
# This thing is a monstrosity and I desperately need to simplify it if I can.
NAME="$(filename $0)"
USAGE="Usage: $NAME [max threads] <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [max threads] <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
THREAD_LIMIT="$1"

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Returns everything except the last argument, otherwise does nothing.
NAME="$(filename $0)"
USAGE="Usage: $NAME [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ "#$" != "0" ] ; then
ARGS="$@"

View File

@ -7,9 +7,12 @@
# grep grep
# sed sed
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
IFS='
'

View File

@ -4,9 +4,12 @@
# Requires: <program> <package (Devuan)>
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ ! -t 0 ] ; then
read LINE

View File

@ -4,9 +4,12 @@
# Requires: <program> <package (Devuan)>
# echo coreutils
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ ! -t 0 ] ; then
read LINE

View File

@ -1,9 +1,12 @@
#!/bin/sh
# This lets you rotate items in the argument list right by n, and also summons the Antichrist.
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if isnum "$1" ; then
if [ $# -gt 2 ] ; then

View File

@ -1,9 +1,12 @@
#!/bin/sh
# This lets you shift items in the argument list to the right by n.
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME <number> <args ...>"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if isnum "$1" ; then
if [ $# -gt 2 ] ; then

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Sets the exit code to the first argument if the first argument is a number, otherwise, does nothing.
NAME="$(filename $0)"
USAGE="Usage: $NAME <number>"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME <number>"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if isnum "$1" ; then
exit $1

View File

@ -2,9 +2,12 @@
# Generates a signal if a command returns exit code 0.
# Defaults are parent process, SIGUSR1, and 'setcode 1'.
NAME="$(filename $0)"
USAGE="Usage: $NAME [PID] [signal number] <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [PID] [signal number] <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
DEFAULT_PID="$$"
DEFAULT_SIGNAL="10"

View File

@ -3,9 +3,12 @@
# Default status to signal on is 0.
# Ignores everything after the 2nd argument, and ignores the 3rd argument if it's not a number.
NAME="$(filename $0)"
USAGE="Usage: $NAME [PID] [signal number] [exit code] <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [PID] [signal number] [exit code] <command> [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
DEFAULT_PID="$$"
DEFAULT_SIGNAL="10"

View File

@ -1,9 +1,12 @@
#!/bin/sh
# Creates a fifo named after the first argument.
NAME="$(filename $0)"
USAGE="Usage: $NAME [name]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [name]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
FIFODIR="/tmp/fifo"
mkdir -p "$FIFODIR"

View File

@ -4,9 +4,12 @@
# Requires: <program> <package (Devuan)>
# tail coreutils
NAME="$(filename $0)"
USAGE="Usage: [notify-send args...] | $NAME <filename> [command] [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: [notify-send args...] | $NAME <filename> [command] [args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
if [ "$1" != "" ] ; then
FILE="$1"

View File

@ -20,7 +20,6 @@ if [ -z $USAGE_LOCK ] ; then
if [ "$1" != "" ] ; then
echo $CHECK | linefirstargdo firstargnthargdo $(( 4 + $# )) firstnthpipedo $(( $# - 1 )) "$AGAINST" invertstatus linematchfirstargdo echo "$MESSAGE"
CODE="$?"
unset USAGE_LOCK
exit $CODE
fi
fi