Commit 6c5a6957 authored by hadi.atteh's avatar hadi.atteh

added second question solution

parent 9aecd825
#!/bin/bash
# Task 1: Create a new folder in the home directory
mkdir ~/new_folder
# Task 2: Create all possible combinations of files in the new folder
cd ~/new_folder
for i in {1..10}; do
for j in {a..z}; do
touch "file${i}_${j}"
done
done
# Task 3: Append "Hello Linux" to files ending with the letter x
for file in *x; do
echo "Hello Linux" >> "$file"
done
# Task 4: Create folders for each English letter and move files to the correct folder
for letter in {a..z}; do
mkdir "$letter"
mv [a-z]*"$letter" "$letter"
done
# Task 5: Find and delete files containing numbers 3 or 4 in their names
find . -type f -name "*[34]*" -delete
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment