Compare commits
2 Commits
c23a81d8e1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 002d53928a | |||
| edea8a9bd1 |
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
WORD="Hello world"
|
|
||||||
echo $WORD
|
|
||||||
echo $USER
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Script to add all changes, commit with the message "updated", and push to repo.
|
|
||||||
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Check if there are changes to commit
|
|
||||||
if git diff-index --quiet HEAD --; then
|
|
||||||
echo "No changes to commit."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
git commit -m "updated"
|
|
||||||
|
|
||||||
git push
|
|
||||||
|
|
||||||
echo "Changes committed and pushed successfully!"
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
RED='\e[1;31m'
|
|
||||||
GREEN='\e[1;32m'
|
|
||||||
YELLOW='\e[1;33m'
|
|
||||||
BLUE='\e[1;34m'
|
|
||||||
NC='\e[0m'
|
|
||||||
|
|
||||||
user=$(whoami)
|
|
||||||
echo -e "Welcome, ${BLUE}$user${NC}. Please enjoy this short presentation! "
|
|
||||||
|
|
||||||
read -p "Please enter a number:" num
|
|
||||||
if ((num % 2 == 0))
|
|
||||||
then
|
|
||||||
echo "$num is even"
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "$num is odd"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
attempts=3
|
|
||||||
for ((i = 0; i < 3; i++, --attempts))
|
|
||||||
do
|
|
||||||
read -p "You have $attempts attempts left to find the secret recipe, so please enter another number between 1 and 10: " num2
|
|
||||||
secret=1
|
|
||||||
|
|
||||||
if ((num2 == secret))
|
|
||||||
then
|
|
||||||
i=3
|
|
||||||
echo -e "${GREEN}You have found the secret recipe of Coca Cola!! ^_^${NC}"
|
|
||||||
|
|
||||||
else
|
|
||||||
echo -e "${YELLOW}You were so close to finding the secret recipe :(${NC}"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "${BLUE}Let's try something else. Please answer with a *yes* or *no*.${NC}"
|
|
||||||
yes=0
|
|
||||||
no=1
|
|
||||||
|
|
||||||
for ((j = 0; j <= 2; ++j))
|
|
||||||
do
|
|
||||||
|
|
||||||
if ((j == 0))
|
|
||||||
then
|
|
||||||
read -p "Are there any fish with legs?: " Answer
|
|
||||||
if ((Answer == 0))
|
|
||||||
then
|
|
||||||
echo -e "${GREEN}Your answer is correct! Mudskippers are the champions of land-walking fish, but we also have the Lungfish, Walking Catfish, Sea Robins, Frogfish or Handifsh.${NC} Visit: https://factanimal.com/wp-content/uploads/2023/07/mudskipper-breathing.jpg"
|
|
||||||
else
|
|
||||||
echo -e "${RED}Your answer is not correct, but don't worry, you are not the only one :D.${NC} Visit: https://encrypted-tbn0.gstatic.com/licensed-image?q=tbn:ANd9GcR9laMdCqTkfxW005yPkIED-dHsWvq3IcjPToZi130LpKQVlS5JT9W6u-w2ZMCa7JdDPYXUoqwQKakceVaUotuOA6_RCZF1wSfl2Mvoau2PUKen-0U"
|
|
||||||
fi
|
|
||||||
elif ((j == 1))
|
|
||||||
then
|
|
||||||
read -p "Are there any animals with no toes?: " Answer
|
|
||||||
if ((Answer != 0))
|
|
||||||
then
|
|
||||||
echo -e "${GREEN}Your answer is correct! Horses are commonly known for having just a toe under their hooves, but one toe is still more than none!${NC} Visit: https://i.chzbgr.com/full/10509587456/h1B5A4D29/this-actually-is-my-first-rodeo"
|
|
||||||
else
|
|
||||||
echo -e "${RED}Your answer is not correct. There is no animal without any toes. Hooves are modified toenails covering the tips of toes.${NC} Visit: https://cdn.britannica.com/28/85428-050-40FEA973/Hoof-horse.jpg"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
read -p "Is the blue whale the heaviest animal on this planet?: " Answer
|
|
||||||
if ((Answer == 0))
|
|
||||||
then
|
|
||||||
echo -e "${GREEN}Your answer is correct! The second heaviest animal ever to have existed on Earth is the fin whale (Balaenoptera physalus), with some historical estimates reaching up to 130 tons.${NC} Visit: https://www.reddit.com/media?url=https%3A%2F%2Fexternal-preview.redd.it%2FU7IzglHNEVnaT_F58bDjHwB8WqMZDyRNeujcpLqP25s.jpg%3Fwidth%3D1080%26crop%3Dsmart%26auto%3Dwebp%26s%3Df77ae8f9652158dd102218fbb58e1bf665b5a1ab"
|
|
||||||
else
|
|
||||||
echo -e "${RED}Your answer is not correct. Blue whales are widely regarded as the heaviest animals to have ever existed on Earth, with recorded weights up to 190 - 200 tons.${NC} Visit: https://familylifetips.com/wp-content/uploads/2021/07/Whale-Meme-Whale-Hello-There-Family-Life-Tips-Magazine.jpg"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
user=$(whoami)
|
|
||||||
echo "outputul de la comanda whoami este: " $user
|
|
||||||
user="myuser"
|
|
||||||
echo "valoarea variabilei user este acum: " $user
|
|
||||||
|
|
||||||
echo "Ai introdus primul argument: $1"
|
|
||||||
echo "Ai introdus al doilea argument: $2"
|
|
||||||
|
|
||||||
VREME=("ploua" "innorat" "furtuna" "soare")
|
|
||||||
echo "Starea vremii este: $(VREME[0])"
|
|
||||||
echo "Starea vremii este: $(VREME[1])"
|
|
||||||
echo "Starea vremii este: $(VREME[2])"
|
|
||||||
echo "Starea vremii este: $(VREME[3])"
|
|
||||||
|
|
||||||
read nume
|
|
||||||
echo "Numele introus este: $nume"
|
|
||||||
|
|
||||||
read -p "Introdu un nume: " nume
|
|
||||||
echo "Numele introdus este: $nume"
|
|
||||||
echo "Numele introdus este: $(nume:-"Niciun nume introdus")"
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
release_file=/etc/os-release
|
|
||||||
logfile=/var/log/updater.log
|
|
||||||
errorlog=/var/log/updater_errors.log
|
|
||||||
|
|
||||||
check_exit_status() {
|
|
||||||
local status=$1
|
|
||||||
local command_name=$2
|
|
||||||
if [ $status -ne 0 ]
|
|
||||||
then
|
|
||||||
echo "An error occurred during $command_name, please check the $errorlog file."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if grep -q "Ubuntu" $release_file || grep -q "Debian" $release_file
|
|
||||||
then
|
|
||||||
# The host is Debian or Ubuntu
|
|
||||||
# Run the apt version of the command
|
|
||||||
sudo apt update 1>>$logfile 2>>$errorlog
|
|
||||||
check_exit_status $? "apt update"
|
|
||||||
|
|
||||||
sudo apt dist-upgrade -y 1>>$logfile 2>>$errorlog
|
|
||||||
check_exit_status $? "apt dist-upgrade"
|
|
||||||
|
|
||||||
echo "Update completed successfully!"
|
|
||||||
fi
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
release_file=/etc/os-release
|
|
||||||
logfile=/var/log/updater.log
|
|
||||||
errorlog=/var/log/updater_errors.log
|
|
||||||
|
|
||||||
check_exit_status() {
|
|
||||||
local status=$?
|
|
||||||
local command_name=$1
|
|
||||||
if [ $status -ne 0 ]; then
|
|
||||||
echo "$(date): An error occurred during $command_name (exit code: $status). Check $errorlog." | tee -a $logfile
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "$(date): Starting update process..." >> $logfile
|
|
||||||
|
|
||||||
if grep -q "Ubuntu" $release_file || grep -q "Debian" $release_file; then
|
|
||||||
apt update >> $logfile 2>> $errorlog
|
|
||||||
check_exit_status "apt update"
|
|
||||||
|
|
||||||
apt dist-upgrade -y >> $logfile 2>> $errorlog
|
|
||||||
check_exit_status "apt dist-upgrade"
|
|
||||||
|
|
||||||
apt autoremove -y >> $logfile 2>> $errorlog
|
|
||||||
check_exit_status "apt autoremove"
|
|
||||||
|
|
||||||
apt autoclean >> $logfile 2>> $errorlog
|
|
||||||
check_exit_status "apt autoclean"
|
|
||||||
|
|
||||||
echo "$(date): Update completed successfully!" | tee -a $logfile
|
|
||||||
|
|
||||||
# Optional: Check if reboot needed
|
|
||||||
if [ -f /var/run/reboot-required ]; then
|
|
||||||
echo "$(date): Reboot required for updates to take effect." | tee -a $logfile
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "This system is not Ubuntu or Debian-based. Exiting." | tee -a $logfile
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
x=1
|
|
||||||
while (( $x < "10" ))
|
|
||||||
do
|
|
||||||
echo "Valoarea lui x este: $x"
|
|
||||||
x=$(( x+1 ))
|
|
||||||
done
|
|
||||||
|
|
||||||
ar=(11 15 86 23 45 78)
|
|
||||||
Lenght=${#ar[@]}
|
|
||||||
echo "Lungimea array-ului este: $lenght"
|
|
||||||
|
|
||||||
ar=(32 10 132 32 5 7 43 104)
|
|
||||||
i=0
|
|
||||||
lenght=${#ar[@]}
|
|
||||||
while [ $i -lt $lenght ];
|
|
||||||
do
|
|
||||||
echo "Elementul $i din array este: ${ar[$i]}"
|
|
||||||
i=$(( i+1))
|
|
||||||
done
|
|
||||||
@@ -1,3 +1 @@
|
|||||||
Asa functioneaza[develop 7f2020f] Changes
|
Fara modificari
|
||||||
1 file changed, 10 insertions(+)
|
|
||||||
create mode 100644 myWorkspace
|
|
||||||
17
autogit.sh
17
autogit.sh
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Simple script to add all changes, commit with message "updated", and push
|
|
||||||
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Check if there are changes to commit
|
|
||||||
if git diff-index --quiet HEAD --; then
|
|
||||||
echo "No changes to commit."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
git commit -m "updated"
|
|
||||||
|
|
||||||
git push
|
|
||||||
|
|
||||||
echo "Changes committed and pushed successfully!"
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
d
|
|
||||||
f
|
|
||||||
g
|
|
||||||
h
|
|
||||||
h
|
|
||||||
Reference in New Issue
Block a user