Question : How to set a bash unix prompt?

Gents,
I need to remind myself on what machine & directory I am working on constantly. The easiest way to do so would be setting PS1 prompt under bash shell.

But I have odd requirement

I want to set PS1 as
Name of server - Directory (pwd- last 25 chars) -[4 char custom tag]#

For example,
Name of Server : Server1
Pwd : /opt/IBM/WebSphere/AppServer/profiles/Profile01/Node
TAG [Dev] : I will supply

Then it should display
Server1-/profiles/Profile01/Node-Dev#

Regards



Answer : How to set a bash unix prompt?

A word and a blow -

export PS1='$(echo ${HOSTNAME:0:10}|tr "[a-z]" "[A-Z]")-$(echo $PWD|awk "{print substr(\\$1,length(\\$1)-24,25)}")-${TAG:0:4}# '

Random Solutions  
 
programming4us programming4us