Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
homework
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
amjad.arnos
homework
Commits
84880ec8
Commit
84880ec8
authored
Jul 01, 2024
by
amjad.arnos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
myhomework
parent
078e130a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
alive2.sh
alive2.sh
+20
-0
ex2.txt
ex2.txt
+18
-0
shell.sh
shell.sh
+7
-0
No files found.
alive2.sh
0 → 100644
View file @
84880ec8
#!/bin/bash
# alive2.sh
expand_ip_range
()
{
IFS
=
'-'
read
-r
start end
<<<
"
$1
"
IFS
=
'.'
read
-r
i1 i2 i3 i4
<<<
"
$start
"
IFS
=
'.'
read
-r
_ _ _ e4
<<<
"
$end
"
for
ip
in
$(
seq
$i4
$e4
)
;
do
echo
$i1
.
$i2
.
$i3
.
$ip
done
}
for
ip
in
$(
expand_ip_range
$1
)
;
do
ping
-c2
$ip
&> /dev/null
if
[
$?
=
0
]
;
then
echo
"
$ip
is UP"
else
echo
"
$ip
is DOWN"
fi
done
ex2.txt
0 → 100644
View file @
84880ec8
mkdir ~/newfolder
for i in {1..10}; do
for j in {a..z}; do
touch ~/newfolder/file${i}_${j}
done
done
echo "hello Linux" | tee ~/newfolder/*_x
for letter in {a..z}; do
mkdir ~/newfolder/$letter
mv ~/newfolder/*_$letter ~/newfolder/$letter/
done
rm ~/newfolder/*3* ~/newfolder/*4*
shell.sh
0 → 100644
View file @
84880ec8
#!/bin/bash
oldword
=
$1
newword
=
$2
extension
=
$3
find
.
-type
f - name
"*.
$extension
"
-exec
sed
-i
""
s/
$oldword
/
$newword
/g
" {} +
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