rpm的specs學習

參考html

製做rpm包:    https://wangbin.io/blog/it/yum-rpm-make.htmlmysql

linux rpm安裝mysql: https://www.jianshu.com/p/3e46b0c88200linux

rpm 和yum學習: https://www.cnblogs.com/gmlkl/p/9354254.htmlsql

 

url.shbash

#!/bin/bash

# author: shuoqi.yu
# url:    www.runoob.com

url="http://www.runoob.com/login.html"
echo -e "url = ${url}"

# read only
readonly url

# url Length
echo -e "{#url}= ${#url}"

# cut off left begin characters
echo -e "{url#*//} = ${url#*//}"

# cut off left end characters
echo -e "{url##*/} = ${url##*/}"

# cut off right begin characters
echo -e "{url%/*} = ${url%/*}"

# cut off right end characters
echo -e "{url%%/*} = ${url%%/*}"

# part obtain
echo -e "{url:1:6} = ${url:1:6}"

# part obtain
echo -e "{url:7} = ${url:7}"

# part obtain: left first(0) right first(0-)
echo -e "{url:0-7} = ${url:0-7}"

# part obtain
echo -e "{url:0-7:3} = ${url:0-7:3}"
View Code

 

ls.shide

#!/bin/bash

# author: shuoqi.yu

for file in $(ls);do
    echo "${file}"
done
View Code

 

test.sh學習

#!/bin/bash

# author: shuoqi.yu
# url:    www.runoob.com

# quoto url.sh
source ./url.sh


echo -e "$ 0 = $0"
echo -e "$ 1 = $1"
echo -e "$ # = $#"

echo -e "url = ${url}\n"

# define arr
arr=(0 2 4 1 3 5)

# display arr value
echo -e "{arr[1]} = ${arr[1]}"

# display
:<<EOF
echo "This is not display."
EOF

# all arr elements
echo -e "{arr[@]} = ${arr[@]}"

# arr Length
echo -e "{#arr[@]} = ${#arr[@]}"

# single arr element Length
echo -e "{#arr[1]} = ${#arr[1]}"
View Code

 

bubble.cui

/*  Copyright (C) 2019 * Ltd. All rights reserved.
 *      Create date : 2019-09-24 22:33:28
 *================================================*/

#include <stdio.h>

void swap(int *a, int *b)
{
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
}

void bubbleSort(int arr[], int len)
{
    int i=0, j=0, temp;
    for(i=0; i<len-1; i++)
    {
        for(j=0; j<len-1-i; j++)
        {
            if(arr[j] > arr[j+1])
                swap(&arr[j], &arr[j+1]);
        }

    }
}

void printArr(int arr[], int len)
{
    int i = 0;
    for(i=0; i<len; i++)
        printf("%d ", *(arr + i));
    printf("\n");
}

int main()
{
    int arr[] = {22, 34, 3, 32, 82};
    int len = (int) sizeof(arr)/sizeof(arr[0]);
    bubbleSort(arr, len);
    printArr(arr, len);
}
View Code

 

quick.curl

/*  Copyright (C) 2019 * Ltd. All rights reserved.
 *      Create date : 2019-09-24 23:01:59
 *================================================*/

void quickSort(int arr[], int left, int right)
{
    if(left < right)
    {
        int i=left, j=right, tmp=arr[left];
        while(i < j)
        {
            while(i<j && arr[j] >= tmp)
                j--;
            if(i < j)
                arr[i++] = arr[j];
            while(i<j && arr[i] < tmp)
                i++;
            if(i < j)
                arr[j--] = arr[i];
        }
        s[i] = tmp;

        quickSort(arr, left, i-1);
        quickSort(arr, i+1, right);
    }
}
View Code
相關文章
相關標籤/搜索