Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
proj1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hadi.atteh
proj1
Commits
6c5a6957
Commit
6c5a6957
authored
Jun 28, 2024
by
hadi.atteh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added second question solution
parent
9aecd825
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
bash2.sh
bash2.sh
+26
-0
No files found.
bash2.sh
0 → 100755
View file @
6c5a6957
#!/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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment