Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Shell running a script is always non interactive shell. You may force to run the script in interactive mode using '-i' option:</p> <p>Try to change:</p> <pre><code>#!/bin/bash </code></pre> <p>to:</p> <pre><code>#!/bin/bash -i </code></pre> <p>see INVOCATION section in 'man bash' (bash.bashrc is where your PS1 is defined):</p> <pre><code> When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc. When bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following command were executed: if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi but the value of the PATH variable is not used to search for the file name. </code></pre> <p>you can also read: <a href="http://tldp.org/LDP/abs/html/intandnonint.html" rel="nofollow">http://tldp.org/LDP/abs/html/intandnonint.html</a></p> <p>simple test:</p> <pre><code>$ cat &gt; test.sh echo "PS1: $PS1" $ ./test.sh PS1: $ cat &gt; test.sh #!/bin/bash -i echo "PS1: $PS1" $ ./test.sh PS1: ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload