与bash脚本帮助 [英] help with bash script

查看:126
本文介绍了与bash脚本帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个家庭作业:

学生应该编写一个名为fix-permissions.sh一个bash程序接受用户作为参数列表
如果一个用户或多个被赋予作为参数,该脚本应该重置文件的权限如下....

The student should write a bash program named fix-permissions.sh that accepts a list of users as argument If a user or more 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?

推荐答案

这意味着,如果你输入 fix-permissions.sh的user1用户2用户3 在命令行中,你的脚本将处理这些3个用户。在你的脚本,您可以通过这些参数使用去 $ @

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 $@

例如

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

请参见位置参数以手册页更多信息

please see man page on POSITIONAL PARAMETERS for more information

这篇关于与bash脚本帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆