开发者

help with bash script

开发者 https://www.devze.com 2023-01-20 17:23 出处:网络
i have a homework: The student should write a bash program named fix-permissions.sh that accepts a list of users as argument

i have a homework:

The student should write a bash program named fix-permissions.sh that accepts a list of users as argument If a user or 开发者_如何学Gomore are given as arguments, the script should reset files permissions as follows....

"accepts a list of users as argument" can someone explain it to me please?


That means if you input fix-permissions.sh user1 user2 user3 on the command line, your script will process these 3 users. In your script, you go through these arguments using $@

eg

for u in "$@"
do
  echo "$u"
done

please see man page on POSITIONAL PARAMETERS for more information


Positional parameters. $1, $2, $3, $@, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消