Re: run command via ps/bash prompt

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

 



On 3/9/06, Joe Szilagyi <js@xxxxxxxx> wrote:
> Hi,
>
> Have something I have tried to get working, unsuccessfully:
>
> PS1="\n\[`cat $HOME/file.txt`\] \n \@ \u@\h \w $ "
>
> Basically, wanting the bash prompt to always execute a command. It does not
> update, unless bashrc is updated with source .bashrc. Is there any way
> around this directly in the PS1 settings? If not, I saw more complex ways to
> do similar things by defining functions, but was curious if there was a more
> basic way to do this.

you have to quote the `cat ` otherwise it is executed when you define
PS1.  Something like

   PS1="\n\[\`cat $HOME/file.txt\`\]\n \@ \u@\h \w $ "

Should do the trick.

NB $HOME is also evaluated at the point where you define PS1. 
Although probably unnecessary, you could delay that by using \$HOME
instead of just $HOME.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux