Re: Displaying PS1 from shell scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On November 14, 2003 12:50 pm, Peramslist wrote:
> Hi,
>
> I'm need to display the PS1 envronmental variable through a script on my
> RH9 box. When I key in "echo $PS1" in the script I just get a blank but
> when I key in the same at the prompt I get the result. I'd appreciate if
> you can let me know how I can display the variable as I did a google search
> but in vain. Thanks in advance for all your replies.
>
> Regards,
>
> Peram


Hi,
In "non-interactive" bash (a script) there is no PS1, it is unset. To get 
around it you can run the script in interactive mode. It could be a small one 
line script called from another if the -i interferes with something (?).
Anyway, this works:

#!/bin/bash -i
#
echo $PS1
-- 
Pete Nesbitt, rhce


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux