我是 unix shell 脚本的新手。我正在尝试使用参数执行示例函数,但 shell 不将第一个参数识别为第一个参数,而是将其识别为第二个。
#!/bin/bash
func(){
echo "func"
if [ -z $1 ]
then echo "$1 received"
else echo "not received"
fi
}
func "hello"
给出未收到的输出函数
它应该给的地方
func
hello received