📝 Many updates

This commit is contained in:
z3rOR0ne 2022-12-08 13:24:52 -08:00
parent 2809ea08cf
commit c10b15767a
7 changed files with 76 additions and 18 deletions

44
scripts/listargs Executable file
View file

@ -0,0 +1,44 @@
#!/usr/bin/env bash
# interesting things found on stack overflow regarding listing arguments and
# grabbing values of other arguments
# while getopts h x; do
# echo "has -h";
# done; OPTIND=0
# for ((i = 0; i < $#; i++)) ; do
# case "$*" in
# (-u) echo "Has -u";
# break
# esac
# done
list=( agpl-3.0 bsd-2-clause bsd-3-clause mit )
# echo "list of arguments ${list[0]}"
for (( i = 0; i < ${#list[@]}; i++)) ; do
if [[ "agpl-3.0" == "${list[$i]}" ]] ; then
echo "yep"
exit 0
else
echo "nope"
fi
done
#
# args=("$@")
# for (( i=0; i < $#; i++)) ; do
# j=$((i+1))
# if [[ "${args[$i]}" == '-u' ]] ; then
# echo "$i is equal -u"
# echo "the following argument to -u is ${args[$j]}"
# fi
# echo "${!i} ${!j}"
# done
# case "$*" in
# (-u) echo "Has -u";;
# esac
# for arg in "$@"
# do
# echo "argument is: $arg"
# done

View file

@ -2,7 +2,10 @@
# A simple bookmarking alias used in conjunction with sdir and our $HOME/.aliases file to bookmark our current directory to be returned to later using rdir.
# grabs the current $sdir environment variable
source $HOME/.zshrc
# grabs the rc file of preferred shell (only works with bash and zsh currently)
shellrc=.$(echo "$SHELL" | awk -F '/' '{ print $NF }')rc
cd $sdir && ls
# grabs the current $sdir environment variable
source "$HOME"/"$shellrc"
cd "$sdir" && ls

View file

@ -1,23 +1,22 @@
#!/bin/bash
# A simple bookmarking alias used in conjunction with rdir and our $HOME/.aliases file to bookmark our current directory to be returned to later using rdir.
# make sure we don't overwrite our .shrc
set -o noclobber
# save our current working directory
sdir=$(pwd)
# grabs the rc file of preferred shell (only works with bash and zsh currently)
shellrc=.$(echo "$SHELL" | awk -F '/' '{ print $NF }')rc
# grabs the last line of our .zshrc, and grabs the first word
last_line_first_word=$(awk '{w=$1} END{print w}' $HOME/.zshrc)
last_line_first_word=$(awk '{w=$1} END{print w}' "$HOME"/"$shellrc")
# if the last line of our rc file begins with "export"...
# remove the last line of our rc file
if [[ $last_line_first_word == "export" ]] ; then
sed -i '$ d' $HOME/.zshrc
sed -i '$ d' "$HOME"/"$shellrc"
fi
# save our current working directory
sdir=$(pwd)
# make sure we don't overwrite our .zshrc
set -o noclobber
# and write that directory temporarily, appending it onto the end of our .zshrc
echo 'export sdir='$sdir >> $HOME/.zshrc
# and write that directory temporarily, appending it onto the end of our rc
echo 'export sdir='"$sdir" >> "$HOME"/"$shellrc"
# immediately source it to use it in this shell session
source $HOME/.zshrc
source "$HOME"/"$shellrc"

3
scripts/testman Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
groff -Tascii -man "$1" | less