the difference between "./" and "sh"

本文详细解释了如何使用shell命令执行脚本文件。探讨了两种不同的执行方式:通过sh命令指定脚本文件作为参数,此时脚本文件不需要执行权限;以及直接使用./脚本名的方式执行,这种方式下脚本文件需要具备执行权限。
In simple words, sh file1 executing sh command/executable with file1 as a parameter. *** In this case file1 doesn't require execute privilege*** as sh executable read and intercept the commands in the file.


简单来说,sh file1以file1作为参数执行sh命令/可执行文件。在这种情况下,file1不需要执行权限,因为sh可执行文件读取和截取文件中的命令

./file1 its nothing but running/executing an executable file file1, ***hence it requires executable privileges***. In this case it executes on the shell mentioned in the shebang #!/bin/sh if its not mentioned then its on the current shell.

./file1它只是运行/执行一个可执行文件file1,因此它需要可执行的权限。在这种情况下,它执行在shebang#!/ bin / sh中提到的shell,如果它没有提到当前的shell。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值