#!/bin/sh #count the number of files in current directory, and check if the number is equal to or greater than or less than 26 #NOF represents number of files NOF=`ls -l | wc -l` if [ $NOF -eq 26 ] then echo “No of files and directories is equal to 26” fi if [ $NOF …
Category: শেল প্রোগ্রামিং – Shell Programming
শেল প্রোগ্রামিং - Shell Programming
Apr 16
শেল প্রোগ্রামিং while লুপ এর উদাহরণ । একটি চার্ট প্রদর্শন করুন
Example Output bash-3.2$ ./while-loop-example.sh Enter your Number 10 10 * 1 = 10 10 * 2 = 20 10 * 3 = 30 10 * 4 = 40 10 * 5 = 50 10 * 6 = 60 10 * 7 = 70 10 * 8 = 80 10 * 9 = 90 10 * …
Apr 16
বৃহস্পতিবার এবং শুক্রবারে / etc ফোল্ডারে সমস্ত বিষয়বস্তু /export/home/shell/test/etc.tar তে tar হিসাবে backup করুন
#!/bin/ksh # on every thursday and friday tar all contents of /etc folder into /export/home/shell/test/. On thursday only create a log file with the list of files #in the tar file. On thursday untar /export/home/shell/test/etc.tar into vfstab . Then log vfstab exist or not information DAY=`date +%a` DATESTAMP=`date +%m-%d-%Y-%H:%M` if [[ “$DAY” == Mon ]] …
Apr 16
শেল প্রোগ্রামিং এ if-then-else এর উদাহরণ
#!/bin/sh #If then else example #if elif else NOF=5 if [ $NOF -eq 27 ] then echo “No of files and directories = 27” elif [ $NOF -gt 27 ] then echo “No of files are dir are greator than 27” else echo “No of files and directories are less than 27” fi exit
Apr 16
উদাহরণঃ case এর ব্যবহার। আজকের দিনটির নাম দেখান
bash-3.2$ cat ksh_case_example_1.sh #!/bin/ksh #show today’s day name DAY=`date +%a` #show value of $DAY echo $DAY #based on the value of the DAY variable show the day name in full format case “$DAY” in Mon) echo “Monday” ;; Tue) echo “Tuesday” ;; Wed) echo “Wednesday” ;; Thu) echo “Thursday” ;; Fri) echo “Friday” ;; Sat) …
Apr 16
For লুপ এর ব্যবহার
bash-3.2$ cat multiplication.sh #!/bin/bash # Example use of function/method declaration in Shell Programming # Example use of for loop #a function that will multiply 1 to 10 with 5 multiplication() { x=5 for i in {1..10} do echo $i echo “the multiplication result is:” $(($i*$x)) done } echo “Print 1 to 10; also multiply each …
Apr 16
case এর ব্যবহার
Example Output: 10 * 1 = 10 10 * 2 = 20 10 * 3 = 30 10 * 4 = 40 10 * 5 = 50 10 * 6 = 60 10 * 7 = 70 10 * 8 = 80 10 * 9 = 90 10 * 10 = 100 ———————————- #!/bin/bash multi() …
Apr 16
৩০ সেকেন্ড পর পর যে সমস্ত শেল রান করছে তাদের ডাটা একটা লগ ফাইল এ সেভ করতে হবে
#!/bin/sh #find all currently running shells and create in full listing form for them . Log the data into a file in every 30 secs # -e means currentl running # -f means full format output # sleep takes parameters in seconds ps -ef | grep shell >> process.log sleep 30 ps -ef | grep …
Apr 16
case এর অন্য একটি ব্যবহার . Example use of case
ফলাফল bash-3.2$ ./ksh_case_chart.sh Enter your Number 9 9 * 1 = 9 9 * 2 = 18 9 * 3 = 27 9 * 4 = 36 9 * 5 = 45 9 * 6 = 54 9 * 7 = 63 9 * 8 = 72 9 * 9 = 81 9 * 10 …
Apr 16
case এর ব্যবহার . Example use of case
Example Output: 10 * 1 = 10 10 * 2 = 20 10 * 3 = 30 10 * 4 = 40 10 * 5 = 50 10 * 6 = 60 10 * 7 = 70 10 * 8 = 80 10 * 9 = 90 10 * 10 = 100 ———————————- #!/bin/bash multi() …
- 1
- 2