Bash shebang option -l

后端 未结 1 1212
长情又很酷
长情又很酷 2021-02-18 22:18

I use a script, test.sh, written by someone else, the begins with a bash shebang:

#!/bin/bash -l
...
echo TEST: $TEST

From what I

1条回答
  •  花落未央
    2021-02-18 22:57

    The -l option (according to the man page) makes "bash act as if it had been invoked as a login shell". Login shells read certain initialization files from your home directory, such as .bash_profile. Since you set the value of TEST in your .bash_profile, the value you set on the command line gets overridden when bash launches.

    0 讨论(0)
提交回复
热议问题