Add complex file operations script for testing
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
archos 2024-05-24 16:27:54 +02:00
parent 57052b7595
commit 13c753c575
2 changed files with 41 additions and 6 deletions

View File

@ -1,12 +1,10 @@
steps: steps:
- name: test - name: file_operations
image: ubuntu image: ubuntu
commands: commands:
- echo "Starting tests" - echo "Starting file operations tests"
- ls -la - ./file_operations.sh
- echo "Running tests" - echo "File operations tests complete"
- ./start_woodpecker_agent.sh
- echo "Tests complete"
when: when:
branch: branch:
- master - master

37
file_operations.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# Vytvoření souborů
echo "Vytváření souborů..."
touch file1.txt file2.txt file3.txt
echo "Toto je soubor 1" > file1.txt
echo "Toto je soubor 2" > file2.txt
echo "Toto je soubor 3" > file3.txt
# Kontrola obsahu souborů
echo "Kontrola obsahu souborů..."
cat file1.txt
cat file2.txt
cat file3.txt
# Přesunutí souborů do nového adresáře
echo "Přesunutí souborů do adresáře 'new_directory'..."
mkdir -p new_directory
mv file1.txt file2.txt file3.txt new_directory/
# Kontrola, zda jsou soubory přesunuty
echo "Kontrola souborů v adresáři 'new_directory'..."
ls new_directory/
# Smazání souborů a adresáře
echo "Mazání souborů a adresáře..."
rm -rf new_directory/
# Kontrola, zda byly soubory a adresář smazány
echo "Kontrola, zda byly soubory a adresář smazány..."
if [ -d "new_directory" ]; then
echo "Adresář 'new_directory' nebyl smazán!"
else
echo "Adresář 'new_directory' byl úspěšně smazán."
fi
echo "Operace se soubory byly dokončeny."