Created a folder for Misc stuff and rewritten README files in english
This commit is contained in:
3
Misc/README.md
Normal file
3
Misc/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Misc #
|
||||
|
||||
Here I'll put my misc tests and experiments. For example testing out loops, new features I've found in book, or simply just scripts I've made for the fun of it.
|
16
Misc/count_args.sh
Executable file
16
Misc/count_args.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Jack-Benny Persson
|
||||
# LX 13
|
||||
# Test to count arguments to a script
|
||||
|
||||
echo "You entered $# arguments"
|
||||
echo "The last argument was ${!#}"
|
||||
echo "The arguments entered was: $*"
|
||||
|
||||
echo "Iterating throuh all the arguments: "
|
||||
for i in $@; do
|
||||
echo "$i"
|
||||
done
|
||||
|
||||
exit 0
|
29
Misc/jack.sh
Executable file
29
Misc/jack.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Jack-Benny Persson
|
||||
# LX13
|
||||
# From the classic movie The Shining
|
||||
|
||||
Text=(A l l " " w o r k " " a n d " " n o " " p l a y " " m a k e s " " \
|
||||
J a c k " " a " " d u l l " " b o y "." " " )
|
||||
|
||||
while true
|
||||
do
|
||||
SemiRand=`date +%S`
|
||||
if [ $SemiRand -eq 10 ] || [ $SemiRand -eq 45 ]; then
|
||||
printf "\n"
|
||||
fi
|
||||
|
||||
if [ $SemiRand -eq 15 ] || [ $SemiRand -eq 35 ] || \
|
||||
[ $SemiRand -eq 36 ] || [ $SemiRand -eq 37 ]; then
|
||||
printf "\n\n\t"
|
||||
fi
|
||||
|
||||
for i in "${Text[@]}"
|
||||
do
|
||||
sleep 0.05
|
||||
printf "$i"
|
||||
done
|
||||
done
|
||||
|
||||
exit 0
|
74
Misc/push.sh
Executable file
74
Misc/push.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# #
|
||||
# Copyright (C) 2011 Jack-Benny Persson <jake@cyberinfo.se> #
|
||||
# #
|
||||
# This program is free software; you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation; either version 2 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program; if not, write to the Free Software #
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
## Interactive git add/commit/push for beginners ##
|
||||
|
||||
# Declare some variables
|
||||
Git=/usr/bin/git
|
||||
Repo=$HOME/testgit
|
||||
Msg="$1"
|
||||
|
||||
# Sanity checks
|
||||
if [ $# -ne 1 ]; then
|
||||
echo 'Usage: $0 "commit message"'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -x $Git ]; then
|
||||
echo "Can't execute $Git"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -d $Repo ]; then
|
||||
echo "$Repo does not exist"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ -d $Repo ]; then
|
||||
if [ ! -d $Repo/.git ]; then
|
||||
echo "$Git is not a git repository"
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enter our repo, list changes and ask to commit them
|
||||
cd $Repo
|
||||
|
||||
git status
|
||||
|
||||
printf "\nAre you sure you want to commit and push these changes? (y/n)"
|
||||
read ShallWe
|
||||
|
||||
if [ "$ShallWe" = "y" ]; then
|
||||
echo "Adding, commiting & pushing"
|
||||
git add -A
|
||||
git commit -m "$Msg"
|
||||
git push
|
||||
elif [ "$ShallWe" = "n" ]; then
|
||||
echo "Aborting"
|
||||
exit 1
|
||||
else
|
||||
echo "Please choose y(es) or n(o)"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
exit 0
|
12
Misc/shifty_stuff.sh
Executable file
12
Misc/shifty_stuff.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Jack-Benny Persson
|
||||
# LX13
|
||||
# Testing out shift
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
echo $1
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user