当前位置:科普知识站>IT科技>

linux执行文件命令

IT科技 阅读(2.74W)

linux系统下执行文件命令是:./test.sh。

1、cd /test ./test.sh ./表示在当前目录。

2、/test/test.sh 以绝对路径去执行。

3、cd /test bash test.sh 或者 sh test.sh 该命令是将test.sh作为参数传给sh(bash)命令来执行的。

4、cd /test. test.sh 或者 source test.sh

注意:前三种方法是在父shell(当前shell)开启一个子shell环境,然后在子shell环境中执行,执行完,子shell环境关闭,然后回到父shell,第四种是在父shell中执行的。

linux执行文件命令