Commit 84880ec8 authored by amjad.arnos's avatar amjad.arnos

myhomework

parent 078e130a
#!/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
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*
#!/bin/bash
oldword=$1
newword=$2
extension=$3
find . -type f - name "*.$extension" -exec sed -i ""s/$oldword/$newword/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