Skip to content

Instantly share code, notes, and snippets.

@eqhmcow
Last active July 18, 2022 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eqhmcow/1403041 to your computer and use it in GitHub Desktop.
Save eqhmcow/1403041 to your computer and use it in GitHub Desktop.
SYNTAX ERROR: UNEXPECTED END OF FILE
cp /bin/bash ./bash.caps; echo "this will take a while, be patient..."; strings -n 10 bash.caps | egrep -e '^.* .* .* .*$' | grep -Pv '^(_|\s)|\$|\[|;|@|\s\s' | while read i; do perl -pi -e "$/=\"\\0\";next if/ function\S|binding|^(case|select|for|trap|builtin)|_.*_/;next unless m@\\Q$i\\E@;sub b{return\$_ if/%/;uc}\$_=join' ',map{b()}split/ /" bash.caps; done; chmod a+x bash.caps; ./bash.caps
@Eskuper
Copy link

Eskuper commented Jul 18, 2022

#!/bin/bash
top=0
deger=1
count=0
ort=0
max=0
min=0
echo "1.sayıyı giriniz"
read deger
echo "2.sayıyı giriniz"
read deger2

if [ "$deger" -gt "$deger2" ] then
for mun in seq $deger $deger2
do
ret=$(factor $mun | grep $mun | cut -d ":" -f 2 | cut -d " " -f 2) # factor komutu ile girilen sayıların arasndaki asalları buluyoruz ve onları grep komutu ile çıktılarını kontrol ediliyor.

if [ "$ret" -eq "$mun" ]
then
if [ count==0 ]
then
(( max=$ret ))
fi
echo "$mun sayısı ASAL sayıdır.."
((count++))
top=$(( $top + $mun )) #top değişkenine sıfır atayıp 0 her defasında çıkan asalı yani $mun değişkenini if ile döndüre döndüre bir önceki aldığı değer ile toplatıp bütün asalların toplamı bulunyor
ort=$(echo "$top/$count" | bc -l)

elif [ "$deger2" -gt "$deger" ]
then
for mun in seq $deger2 $deger
do

ret=$(factor $mun | grep $mun | cut -d ":" -f 2 | cut -d " " -f 2)

if [ "$ret" -eq "$mun" ]
then
if [ count==0 ]
then
(( max=$ret ))
fi
echo "$mun sayısı ASAL sayıdır.."
((count++))
top=$(( $top + $mun )) #top değişkenine sıfır atayıp 0 her defasında çıkan asalı yani $mun değişkenini if ile döndüre döndüre bir önceki aldığı değer ile toplatıp bütün asalların toplamı bulunyor
ort=$(echo "$top/$count" | bc -l)
fi
done
fi

echo -e "\n//// İŞLEMİN SONUÇLARI ////"
echo -e "\nAsalların Toplamı: $top"
echo -e "\nGirdiğiniz sayıların arasında $count adet ASAL vardır....."
echo -e "\nSayıların ortalaması: $ort"
echo -e "\nEn BÜyük asal sayı$max"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment