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
mohamed.mardeen
HomeWork
Commits
5defcb9b
Commit
5defcb9b
authored
Jul 01, 2024
by
mohamed.mardeen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
Waleed_HomeWork
Waleed_HomeWork
+68
-0
No files found.
Waleed_HomeWork
0 → 100644
View file @
5defcb9b
script 1
#!/bin/bash
currentdi=$(pwd)
for item in "$currentdi"/**/*.txt; do
if [[ -f "$item" ]]; then
sed -i 's/oldworld/newworld/g' "$item"
fi
done
========================================================================================
script 2
#!/bin/bash
new_folder="$HOME/new_folder"
mkdir -p "$new_folder"
for l in {a..z}; do
for n in {1..10}; do
filename="file${n}_${l}"
touch "$new_folder/$filename"
done
done
for file in "$new_folder"/*_x; do
echo "Hello Linux" > "$file"
done
for l in {a..z}; do
folder="$new_folder/$l"
mkdir -p "$folder"
mv "$new_folder"/*_$l "$folder"
done
find "$new_folder" -type f \( -name "*3*" -o -name "*4*" \) -delete
========================================================================================
script 3
#!/bin/bash
# alive2.sh
stIp=$(echo "$1" | cut -d- -f1)
endIp=$(echo "$1" | cut -d- -f2)
network_prefix=$(echo "$stIp" | cut -d. -f1-3)
stRange=$(echo "$stIp" | cut -d. -f4)
endRange=$(echo "$endIp" | cut -d. -f4)
if (( endRange >= stRange )); then
for ((n=stRange; n<=endRange; n++)); do
host="$network_prefix.$n"
ping -c2 "$host" &> /dev/null
if [ $? = 0 ]; then
echo "$host is UP"
else
echo "$host is DOWN"
fi
done
else
echo "The end range is smaller than the start range."
fi
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