vault backup: 2024-01-21 00:27:23

This commit is contained in:
2024-01-21 00:27:23 +00:00
parent 358e43950b
commit 7a6e5c1b31
46 changed files with 1226 additions and 14 deletions

View File

@@ -0,0 +1,10 @@
#!/bin/bash
if [ $# -eq 1 ] && [ -f $1 ]; then
mv $1 ./wastebasket/$1
echo "file $1 moved to ./wastebasket/$1"
elif [ $# -eq 1] && [ -d $1 ]; then
mv -R $1 ./wastebasket/$1
echo "directory $1 moved to ./wastebasket/$1"
else
echo "More than one file supplied"
fi

View File

@@ -0,0 +1,14 @@
#!/bin/bash
echo -n Enter num:
read num
if [ "$num" = "" ]; then
echo No input
elif echo $num | grep -Eq '[^0-9]'; then
echo Not an integer
elif [ $num -gt 5 ]; then
echo Greater than 5
elif [ $num -eq 5 ]; then
echo Equal to 5
else
echo Less than 5
fi

View File

@@ -0,0 +1,9 @@
#!/bin/bash
for file in ~/*; do #For every item in the user's home directory.
if [ -d "$file" ]; then
echo $file is a directory
elif [ -f "$file" ]; then
lines=$(cat "$file" | wc -l)
echo $file is a file with $lines lines
fi
done

View File

@@ -0,0 +1,6 @@
#!/bin/bash
if [ $# -eq 2 ]; then
echo "2 arguments (\"$1\" and \"$2\")"
else
echo Please give me 2 arguments
fi