On 03/30/2018 11:10 AM, Bas Zoutendijk wrote:
> On Fri 30 Mar 2018 at 10:33:45 -0600, the...@sys-concept.com wrote:
>> I'm using a scrip to log-in/boot strap the system over NFS
>>
>> -----
>> #!/bin/sh
>>
>> HOST=${0##*/}
>> HOST=${HOST#*-}
>> ROOT=/mnt/${HOST}
>> ...
>> exec chroot '${ROOT}' /bin/bash -l
>> ---
>>
>> When I'm presented with bash prompt, it is the same as the one I logged
>> IN from.  So to eliminate the confusion I would like to change (add to)
>> the bash prompt the "HOST' name I log-in to.
>>
>> When I log-in I'm presented with: "syscon3 #"
>> I would like it to be: ROOT+HOST
>> eg.: syscon3-eden
> 
>   To change the prompt you want to set $PS1.  For example:
> 
>     echo 'export PS1="some string"; exec </dev/tty' | exec chroot $ROOT 
> /bin/bash -i
> 
> This command tells the Bash inside the chroot to first execute
> 
>     export PS1="some string"
> 
> and then to  continue as a regular log-in  shell.  The special syntax of
> the $PS1 string in described in the  Bash man page.  If you just want to
> prepend a string, you do not even have to bother with crafting a syntax:
> 
>     echo 'export PS1="(chroot '$HOST') $PS1"; exec <dev/tty' | exec chroot 
> $ROOT /bin/bash -i
> 
>                                                               Sincerely,
> 
>                                                                  Bas

The above syntax produced an error: 

chroot-eden: line 30: syntax error near unexpected token `('
chroot-eden: line 30: `echo 'export PS1="(chroot '$HOST') $PS1"; exec <dev/tty' 
| exec chroot $ROOT /bin/bash -i'

I've tried it without brackets "()" no effect.

--
Thelma

Reply via email to