title: Getting external PS1 value inside bash script
body: <p>I need to get the value of the <code>PS1</code> variable inside a bash script. </p>
  
  <p>I know that running the script with a dot before makes bash pass env variables to the script, but I need to get <code>PS1</code> regardless of how it is invoked, since I don't trust who will run the script.</p>
  
  <p>How do I get it?</p>
  
  <p><strong>Update</strong>:
  the variable has been exported in <code>/etc/profile</code>, but I cannot get it:</p>
  
  <pre><code>[ Test ] root@myhost:~# export | grep PS1
  declare -x PS1="[ Test ] \\u@\\h:\\w\\\$ "
  [ Test ] root@myhost:~# cat test.sh 
  echo $PS1
  [ Test ] root@myhost:~# bash test.sh 
  </code></pre>
  
  <p>I get no output from the last command.</p>