1 |
On Fri 30 Mar 2018 at 10:33:45 -0600, thelma@×××××××××××.com wrote: |
2 |
> I'm using a scrip to log-in/boot strap the system over NFS |
3 |
> |
4 |
> ----- |
5 |
> #!/bin/sh |
6 |
> |
7 |
> HOST=${0##*/} |
8 |
> HOST=${HOST#*-} |
9 |
> ROOT=/mnt/${HOST} |
10 |
> ... |
11 |
> exec chroot '${ROOT}' /bin/bash -l |
12 |
> --- |
13 |
> |
14 |
> When I'm presented with bash prompt, it is the same as the one I logged |
15 |
> IN from. So to eliminate the confusion I would like to change (add to) |
16 |
> the bash prompt the "HOST' name I log-in to. |
17 |
> |
18 |
> When I log-in I'm presented with: "syscon3 #" |
19 |
> I would like it to be: ROOT+HOST |
20 |
> eg.: syscon3-eden |
21 |
|
22 |
To change the prompt you want to set $PS1. For example: |
23 |
|
24 |
echo 'export PS1="some string"; exec </dev/tty' | exec chroot $ROOT /bin/bash -i |
25 |
|
26 |
This command tells the Bash inside the chroot to first execute |
27 |
|
28 |
export PS1="some string" |
29 |
|
30 |
and then to continue as a regular log-in shell. The special syntax of |
31 |
the $PS1 string in described in the Bash man page. If you just want to |
32 |
prepend a string, you do not even have to bother with crafting a syntax: |
33 |
|
34 |
echo 'export PS1="(chroot '$HOST') $PS1"; exec <dev/tty' | exec chroot $ROOT /bin/bash -i |
35 |
|
36 |
Sincerely, |
37 |
|
38 |
Bas |
39 |
|
40 |
-- |
41 |
Sebastiaan L. Zoutendijk | slzoutendijk@×××××.com |