Commit be8bef56 authored by zaynalabideen.alboudi's avatar zaynalabideen.alboudi

Upload Bash

parents
#!/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
#!/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"
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