日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux shell/makefile/gic/python指令速查-inprocess

發布時間:2025/3/21 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux shell/makefile/gic/python指令速查-inprocess 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

    • 🔴gic
        • 1、git commit --amend 的撤銷
        • 2、更改git log中的Author name
    • 🔴python
    • 🔴makefile
        • 1、if/elif/else, 判斷變量的值(if xxx==yes)
        • 2、makefile自動化變量: $@, $^, $<, $?
    • 🔴Linux Shell
      • 終端命令
        • 1、替換所有文件中的某字符串
        • 2、將文件批量重命名
        • 3、VirtualBox掛載文件夾
      • 字符串操作
        • 1、大小寫轉換
        • 2、刪除字符串的頭和尾中的空格,類似python的strip()
        • 3、比較字符串
      • 基本語法
        • 1、傳參數
        • 2、數組
      • linux shell基礎
        • 1、for循環/while
        • 2、if判斷
        • 3、switch-case
        • 4、單行命令

🔴gic

1、git commit --amend 的撤銷

git reflog //先執行git reflog,扎送到commit id git reset ab8f210 //不加--hard,退回add/amend之前狀態 git reset --hard ab8f210 //加hard,退回到ab8f210點,改動也刪除了

2、更改git log中的Author name

git commit --amend --author=“Baron Zhou zhhh891010@163.com”

🔴python

🔴makefile

1、if/elif/else, 判斷變量的值(if xxx==yes)

ifeq ($(TARGET_BUILD_VARIANT),user)MTKCAM_LOG_LEVEL_DEFAULT := 2 else ifeq ($(TARGET_BUILD_VARIANT),userdebug)MTKCAM_LOG_LEVEL_DEFAULT := 3 elseMTKCAM_LOG_LEVEL_DEFAULT := 4 endif

2、makefile自動化變量: $@, $^, $<, $?

$@ 表示目標文件
$^ 表示所有的依賴文件
$< 表示第一個依賴文件
$? 表示比目標還要新的依賴文件列表

🔴Linux Shell

終端命令

1、替換所有文件中的某字符串

sed -i "s/old/new/g" `grep old -rl /www`

2、將文件批量重命名

for f in `find ./ -name "*old*"`;do mv "$f" `echo "$f" | sed 's/old/new/g' `; done

批量刪除后綴

for f in `find ./ -name "*.txt1"`;do mv "$f" `echo "$f" | sed 's/\.txt1//g' `; done

3、VirtualBox掛載文件夾

mount -t vboxsf guazai /mnt/share

字符串操作

1、大小寫轉換

$ test="abcDEF"

把變量中的第一個字符換成大寫 $ echo ${test^} AbcDEF 把變量中的所有小寫字母,全部替換為大寫 $ echo ${test^^} ABCDEF 把變量中的第一個字符換成小寫 $ echo ${test,} abcDEF 把變量中的所有大寫字母,全部替換為小寫 $ echo ${test,,} abcdef

2、刪除字符串的頭和尾中的空格,類似python的strip()

kernel_dir=$(grep LINUX_KERNEL_VERSION * -nrs | awk -F"=" '{print $2}' | sed 's/^[ \t]*//g' | sed 's/[ \t]*$//g')

3、比較字符串

if [[ $str1 > $str2 ]];thenecho $str1" > "$str2 elseecho $str1" < "$str2 fi

基本語法

1、傳參數

$# $? $* = "$1 $2 $3..." $@ = "$1" "$2" "$3"... $$ 腳本運行的當前進程ID號 例子:for i in "$*"; dofor i in "$@"; do

2、數組

定義 : array_name=(value0 value1 value2 value3) 賦值 : array_name[0]=value0 引用 : valuen=${array_name[n]} 特殊符號:echo "數組的元素為: ${my_array[*]}"echo "數組的元素為: ${my_array[@]}"echo "數組元素個數為: ${#my_array[*]}"echo "數組元素個數為: ${#my_array[@]}"

linux shell基礎

1、for循環/while

until condition docommand done while condition docommand done

2、if判斷

3、switch-case

case $aNum in1) echo '你選擇了 1';;*) echo '你沒有輸入 1 到 4 之間的數字';; esac

4、單行命令

if [ $(ps -ef | grep -c "ssh") -gt 1 ]; then echo "true"; fi for var in item1 item2 ... itemN; do command1; command2… done;

總結

以上是生活随笔為你收集整理的Linux shell/makefile/gic/python指令速查-inprocess的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。