#!/bin/bash
a=1
b=2
# 输出交换前的值
echo "交换前:a = $a, b = $b"
# 交换a和b的值
temp=$a
a=$b
b=$temp
# 输出交换后的值
echo "交换后:a = $a, b = $b"
#!/bin/bash
a=1
b=2
# 输出交换前的值
echo "交换前:a = $a, b = $b"
# 交换a和b的值
temp=$a
a=$b
b=$temp
# 输出交换后的值
echo "交换后:a = $a, b = $b"