Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
Linux_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
zaynalabideen.alboudi
Linux_Homework
Commits
be8bef56
You need to sign in or sign up before continuing.
Commit
be8bef56
authored
Jul 01, 2024
by
zaynalabideen.alboudi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload Bash
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
checklive2.bash
checklive2.bash
+23
-0
theBash.bash
theBash.bash
+7
-0
No files found.
checklive2.bash
0 → 100644
View file @
be8bef56
#!/bin/bash
# Check if correct number of arguments is provided
if
[
"$#"
-ne
1
]
;
then
echo
"Usage:
$0
<start_ip>-<end_ip>"
exit
1
fi
# Extract start and end IP addresses from the argument
start_ip
=
$(
echo
$1
|
cut
-d
'-'
-f1
)
end_ip
=
$(
echo
$1
|
cut
-d
'-'
-f2
)
# Iterate through IP addresses in the range
for
n
in
$(
seq
-f
"%03g"
$(
echo
$start_ip
|
cut
-d
'.'
-f4
)
$(
echo
$end_ip
|
cut
-d
'.'
-f4
))
;
do
host
=
$(
echo
$start_ip
|
cut
-d
'.'
-f1-3
)
.
$n
ping
-c2
$host
&> /dev/null
if
[
$?
=
0
]
;
then
echo
"
$host
is UP"
else
echo
"
$host
is DOWN"
fi
done
theBash.bash
0 → 100755
View file @
be8bef56
#!/bin/bash
old_word
=
"
$1
"
search_directory
=
"
$HOME
"
new_word
=
"
$2
"
grep
-r
-l
"
$old_word
"
"
$search_directory
"
|
grep
"
\.
txt$"
| xargs
sed
-i
"s/
$old_word
/
$new_word
/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