---
# System prepended metadata

title: 2-1-other

---

# Shell Script
tags: `Linux`
## 2-1-11 
```
#!/bin/bash
# D
# W
# V

for (( i=1; i<10; i+=3 ))
do
    for (( j=1; j<10; j++ ))
    do
        varTmpi1=$[i+1]
        varTmpi2=$[i+2]
        echo -e -n "$i * $j = $[i*j]\t"
        echo -e -n "$varTmpi1 * $j = $[varTmpi1*j]\t"
        echo -e -n "$varTmpi2 * $j = $[varTmpi2*j]"
        printf "\n"
    done
    if [ $i -eq "7" ]; then break
    else
        echo -e "\n"
    fi
done

exit 0
```

## 2-1-12
```
#!/bin/bash
# Descripion:
# W
# V

varNum=""

read -p  "Enter a number: " varNum

varNum2=$(( varNum - 1 ))

for (( i=0; i<$varNum; i++))
do
    for  (( j=o; j<$varNum; j++))
    do
        if [ $[i+j] -lt $varNum ]
        then
            echo -n "* "
        else
            echo -n "  "
        fi
    done
    varNum2=$(( varNum2 - 1 ))
    printf "\n"
done

exit 0

```

## 2-1-13
```
#!/bin/bash
# Descripion:
# W
# V

varNum=""

read -p  "Enter a number: " varNum

varNum2=$(( varNum - 1 ))

for (( i=0; i<$varNum; i++))
do
    for  (( j=o; j<$varNum; j++))
    do
        if [ $j -ge $varNum2 ]
        then
            echo -n "* "
        else
            echo -n "  "
        fi
    done
    varNum2=$[varNum2-1]
    printf "\n"
done

exit 0
```

## 2-1-14
```
#!/bin/bash
# Descripion:
# W
# V

read -p  "Enter a number: " varNum
varNum2=$(( varNum - 1 ))

for (( i=0; i<$varNum; i++))
do
    for  (( j=o; j<$varNum; j++))
    do
        if [ $i -eq "0" ] || [ $i -eq $varNum2 ]
        then
            echo -n "* "
        elif [ $j -eq "0" ] || [ $j -eq $varNum2 ]
        then 
            echo -n "* "
        else
            echo -n "  "
        fi
    done
    printf "\n"
done

exit 0
```


## 2-1-15
```
# W
# V

varNum=""

read -p  "Enter a number: " varNum

if [ $[varNum%2] -eq "1" ]
then
    echo "Please enter even number."
else
    for (( i=0; i<$[varNum-1]; i++))
    do
        for  (( j=o; j<$varNum; j++))
        do
            if [ $[j-i] -lt "0" ] && [ $[i+j+2] -lt $varNum ]
            then
                echo -n "  "
            elif [ $[j-i] -gt "1" ] && [ $[i+j+1] -gt $varNum ]
            then
                echo -n "  "
            else
                echo -n "* "
            fi
        done
        printf "\n"
    done
fi
exit 0
```

## 2-1-16

### v1
```
#!/bin/bash
# Descripion:
# W
# V
varNum=""
varTmp="0"

read -p  "Enter a number: " varNum
varNum1=$(( varNum / 2 ))
varNum2=$(( varNum1 * 3 ))

if [ $[varNum%2] -eq "0" ]
then 
    echo "Please enter odd number."
else
    for (( i=0; i<$varNum; i++))
    do
        for  (( j=o; j<$varNum; j++))
        do
            if [ $[i+j] -ge $varNum1 ] && [ $[j-i] -le $varNum1 ] && [ $[i-j] -le $varNum1 ] && [ $[i+j] -le $varNum2 ]
            then
                echo -n "* "
            else
                echo -n "  "
            fi
        done
    printf "\n"
    done
fi
exit 0
```
### v2
```
varTmp="0"

read -p  "Enter a number: " varNum
varNum1=$((varNum/2))

if [ $[varNum%2] -eq "0" ]
then
    echo "Please enter odd number."
else
    for ((i=0; i<$varNum; i++))
    do
        for  ((j=0; j<$varNum; j++))
        do
            if [ $i -le $varNum1 ] && [ $j -ge $[varNum1-i] ] && [ $j -le $[varNum1+i] ]
            then
                echo -n "* "
            elif [ $i -gt $varNum1 ] && [ $j -ge $[i-varNum1] ] && [ $j -lt $[varNum-(i-varNum1)] ]
            then
                echo -n "* "
            else
                echo -n "  "
            fi
        done
        printf "\n"
    done
fi
exit 0
```