On Wednesday, November 2, 2011 9:11:12 AM UTC+8, leif wrote: > > On 2 Nov., 01:22, Keshav Kini <kesha...@gmail.com> wrote: > > Another possibility is to set PS1 in the new shell to an expanded PS1 > from > > the old shell by creating a dynamic string: > > > > fs@zhenghe ~/tmp $ echo "export PS1=\"(sage -sh) $PS1\"" #run this > string > > in the new shell > > export PS1="(sage -sh) \[\033[01;32m\]\u@\h\[\033[01;34m\] \w > $\[\033[00m\] > > " > > > > Maybe useful? > > I don't exactly understand what you mean, but at least for bash we > could first run an "interactive" shell to just get the prompt, and > then append to that (PS1) before starting the real interactive shell: > > case "$SHELL_NAME" in > bash) > PS1="`bash -i -c 'echo $PS1'` sage>" > ... > ... > esac > > > -leif
This is very good. It works for all shells probably. Since it works even with busybox (ash shell). ~/tmp> cat test #!/bin/sh echo "this is for ash: $(/bin/busybox sh -i -c 'echo $PS1')" echo "this is for bash: $(bash -i -c 'echo $PS1')" echo "this is for zsh: $(zsh -i -c 'echo $PS1')" ~/tmp> ./test this is for ash: \w \$ this is for bash: \[\033[01;34m\] \w $\[\033[00m\] this is for zsh: %{%}%30<...<%~%(?.. %{%}[%?]%{%} )%{%}>%{%} -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org