sh 可以接受参数,通过使用 $1、$2、$3 等变量来引用。

例如:

#!/bin/sh

echo "The first parameter is $1"
echo "The second parameter is $2"
echo "The third parameter is $3"

在执行该脚本时,可以传递参数,例如:

./script.sh param1 param2 param3

这将输出:

The first parameter is param1
The second parameter is param2
The third parameter is param3
sh 接受参数

原文地址: https://www.cveoy.top/t/topic/8bO 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录