Feature Request, update bash prompt

1 view
Skip to first unread message

Spencer

unread,
Feb 8, 2011, 11:18:11 AM2/8/11
to lasic-users
When lasic deploys a system it should update the bash prompt to
include the node name. It would make it easier to know which system
you are logged into. This is the PS1 variable.

So it goes from:


ubuntu@ip-10-10-10-10:~$

To

ubuntu@www-web-drupal-contrib:~$

Should be simple. :-)

brian pugh

unread,
Feb 15, 2011, 6:50:17 PM2/15/11
to lasic-users
Hi Spencer,

I've added the passing of the node name and index to any script that
is executed in a "script" block to trunk. With that, any LASIC script
can call a script to set the prompt. There is an example here:
http://code.google.com/p/lasic/source/browse/#hg%2Fexamples%2Fsetprompt.

The SCP and Script "setprompt" statements are:
scp {
"http://lasic.googlecode.com/hg/examples/setprompt/setprompt-
ubuntu.sh":"~/setprompt.sh"
}

scripts {
"~/setprompt.sh": {}
}

Those could be added to any LASIC script and it should work. The
setprompt-ubuntu.sh works by appending the setting of PS1 to
the .bashrc.
if [ -n "${NAME+x}" ]; then
echo "PS1=\"\u@$NAME$INDEX$ \"" >> ~/.bashrc
fi

However, this script could be replaced by any script that does
whatever you want to do to get the PS1 variable set if you don't like
this approach (just use the NAME and INDEX variables in the script
that does the PS1 setting).
Reply all
Reply to author
Forward
0 new messages