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