tail +20 < hotel.txt | head -n30 >hlist
tail -n 20 < the100 | head -n30 >hlist
moslem.b نوشته است:خوب رسیدیم به دستور مورد علاقه ی من یعنی همون if
علی جون منتطر اسکریپت هات هستیم
#!/bin/bash
#
# polite time viewer
#
# * Licensed under terms of GNU/GPL v.3
# * author: Ali Ghanavatian
#
#$x= `date +"%T"` #did not work! :-S
x=$(date +"%H")
now=$(date +"%r")
# echo -e "it's $now and the X is $x"
if test $x -gt 12 -a $x -lt 17
then
echo -e "Good after noon master, it's $now"
fi
if test $x -gt 17 -a $x -lt 24
then
echo -e "Good evening master, it's $now"
fi
if test $x -lt 12
then
echo -e "Good morning master, it's $now"
fi
echo -e "have a great time"
#!/bin/bash
#
# an script for counting name's letter
# Licensed under terms of GNU/GPL v.3
# author: Ali Ghanavatian
#
echo "Please enter your first name:"
read fname
fc=$[`echo $fname|wc --chars`-1] # rahmat bar pedar o madare Alen Baghumian :)
echo "alright $fname, now enter your last name:"
read lname
lc=$[`echo $lname|wc --chars`-1]
echo -e "\n--------------------------------------------------------------"
if test $fc -lt 3 -o $lc -lt 3
then
echo -e "\nWARNING! the first or last name may not be accurate!"
fi
echo -e "Dear $fname $lname, here's our character counting result:\n"
echo "$fname : $fc"
echo "$lname : $lc"
echo -e "\nthank you for choosing our service!"
if [$str1 = "yes" -o $str2 = "YES" ]; then
#!/bin/bash
#
# the script creates .war file which is an Java application
# * published under terms of GNU/GPL v.3
# * author: Ali Ghanavatian
#
echo "enter DIR name:"; # a directory for the java application
read theDir
if test -d $theDir # check for directory existance
then
echo "\"$theDir\" directory exist, to confirming delete enter[Y]"
read ans
if [ $ans = "y" -o $ans = "Y" ]; then
rm -r ./$theDir
echo "hint: <$theDir> directory has been deleted..."
else
echo "fatal error: <$theDir> bad directory name"
exit 1
fi
fi
## starting build directory process...
mkdir $theDir
mkdir $theDir/WEB-INF
mkdir $theDir/WEB-INF/classes
# asking for .java Source: [modification after STRINGS]
echo "please enter your .java filename without extension (like: myCode)"
read srcfile
srcfullfile=$srcfile".java"
if [ -f $srcfullfile ]; then
echo "OK with $srcfullfile"
else
echo "fatal error: <$srcfullfile> file not found"
exit 1
fi
# locating sun glass fish folder path
if [ -f sgepath.txt -a -f `cat sgepath.txt`"/lib/javaee.jar" ]; then
echo "OK with locating j2ee lib path"
else
echo "fatal error: <sgepath.txt> file not found"
exit 1
fi
j2eelib=`cat ./sgepath.txt`"/lib/javaee.jar"
if javac -cp $j2eelib $srcfullfile; then
echo "source compiled..."
else
echo "failed to complie source"
exit 1
fi
cp $srcfile".class" $theDir/WEB-INF/classes
if [ -f web.xml ]; then
echo "OK with web.xml" ## more modification after reading STRINGS
else
echo "web.xml file not found"
exit 1
fi
cp web.xml $theDir/WEB-INF/
cd $theDir
if jar cvf $srcfile".war" .
then
echo "done with packaging, $srcfile.war is ready"
else
echo "fatal error"
exit 0
fi
echo "copiny to autodeploy folder..."
adeploypath=`cat ../sgepath.txt`"/domains/domain1/autodeploy"
cp $srcfile".war" $adeploypath
cd ..
echo "Done."
#!/bin/bash -x
x=hell
xw=$x"o world"
echo $xw
#!/bin/sh
echo please choose 1 or 2
echo ----------------------
echo 1- Backup Package
echo
echo 2- Restore Package
echo ----------------------
read name
if [ $name = "1" ]
then
mkdir ~/Desktop/Backup
mkdir ~/Desktop/Backup/lib
mkdir ~/Desktop/Backup/etc
mkdir ~/Desktop/Backup/apt
cp -r /var/cache/apt/archives ~/Desktop/Backup
cp -r /etc/apt ~/Desktop/Backup/etc
cp -r /var/lib/apt ~/Desktop/Backup/lib
cp /var/cache/apt/pkgcache.bin ~/Desktop/Backup/apt
cp /var/cache/apt/srcpkgcache.bin ~/Desktop/Backup/apt
chmod -R 777 ~/Desktop/Backup
elif [ $name = "2" ]
then
cp -r ~/Desktop/Backup/archives /var/cache/apt
cp -r ~/Desktop/Backup/etc /etc/apt
cp -r ~/Desktop/Backup/lib /var/lib/apt
cp ~/Desktop/Backup/apt/pkgcache.bin /var/cache/apt
cp ~/Desktop/Backup/apt/srcpkgcache.bin /var/cache/apt
else
echo "I dont know this number"
fi
Please enter your first name:
+ read fname
Ali
++ echo Ali
++ wc --chars
+ fc=3
+ echo 'alright Ali, now enter your last name:'
alright Ali, now enter your last name:
+ read lname
Go
++ echo Go
++ wc --chars
+ lc=2
+ echo -e '\n--------------------------------------------------------------'
--------------------------------------------------------------
+ test 3 -lt 3 -o 2 -lt 3
+ echo -e '\nWARNING! the first or last name may not be accurate!'
WARNING! the first or last name may not be accurate!
+ echo -e 'Dear Ali Go, here'\''s our character counting result:\n'
Dear Ali Go, here's our character counting result:
+ echo 'Ali : 3'
Ali : 3
+ echo 'Go : 2'
Go : 2
+ echo -e '\nthank you for choosing our service!'
thank you for choosing our service!
;کسانی که اکنون در این تالار هستند: کاربری نام ننوشته است کاربر و 4 میهمان