Shell 常用函数

Friday, Dec 13, 2024 | 1 minute read | Updated at Friday, Dec 13, 2024

@
Shell 常用函数

Cut out summary from your post content here.

The remaining content of your post.

带颜色打印

#!/bin/bash

# 红色
printf "\033[31mThis is red text\033[0m\n"

# 绿色
printf "\033[32mThis is green text\033[0m\n"

# 黄色
printf "\033[33mThis is yellow text\033[0m\n"

# 蓝色
printf "\033[34mThis is blue text\033[0m\n"

忘记干啥的了

awk '{for(i=0;++i<=NF;)a[i]=a[i]?a[i] FS $i:$i}END{for(i=0;i++<NF;)print a[i]}' 

++i操作

a=1  
a=$(($a+1))  
a=$[$a+1]  
a=`expr $a + 1`  
let a++  
let a+=1

© 2016 - 2025 Caisong's Blog

🌱 Powered by Hugo with theme Dream.

About Me

大龄程序员,喜欢折腾各种环境部署、软件应用。

博客记录日常。