我经常遇到在 if 语句中使用这种语法的小型 bash 脚本:
some command > /dev/null 2>&1Run Code Online (Sandbox Code Playgroud)
/dev/null这样输出的目的是什么,什么2>&1意思?
它似乎总是有效,但我想知道它在做什么。
我遇到了这个脚本:
#!/bin/sh
qemu-system-x86_64 -enable-kvm \
-m 2G \
-device virtio-vga,virgl=on \
-drive file=/home/empty/qemubl/lab.img,format=raw,if=virtio \
-cpu host \
-smp 4 \
-soundhw sb16,es1370 \
"$@"
Run Code Online (Sandbox Code Playgroud)
的作用是$@什么?
我搜索man bash了$@,但得到Pattern not found。