Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Shell Scripting Examples -Charan.pptx
1.
2. Script to Print 1 to 10
#!/bin/bash
i=1
while [ $i -le 10 ]
do
echo $i
i=$(($i+1))
Done
Output:
3. Script to find Factorial of the given number
#!/bin/bash
echo "Enter the number"
read n
fact=1
for ((i=1;i<=n;i++))
do
fact=`expr $fact * $i`
Done
The Factorial of $n is $fact
Output:
4. Script to Add two numbers using function
#!/bin/bash
function add()
{
sum=$(($1 + $2))
echo "Sum = $sum"
}
a=10
b=20
add $a $b
Output
5. Script to Display Multiplication table of Given Number using function
#!/bin/bash
tables()
{
i=1
while [ $i -le 10 ]
do
echo " $1 * $i =`expr $1 * $i ` "
i=`expr $i + 1`
done
}
echo "Enter the number to Generate Multiplication table : "
read n
tables $n
10. Script to Test if File Exists are not
#!/bin/bash
filename=$1
if [ -f "$filename" ]; then
echo "File exists"
else
echo "File does not exist"
fi
Output
11. Script to Print File with Line Count
#!/bin/bash
myfile=$1
i=1
while read lines;
do
echo "$i : $lines"
i=$((i+1))
done < $myfile
Output
12. Script to Remove Duplicate lines from File
#! /bin/bash
echo -n "Enter Filename-> "
read filename
if [ -f "$filename" ]; then
sort $filename | uniq | tee sorted.txt
else
echo "$filename is not found...try again"
fi
Continued……..