How to customize PS1 prompt in BASH?  

Monday, October 18, 2010

Edit your .bashrc

export PS1="[\u@\w]\n>"

output:
[ubuntu@~/temp]
>



Relevant info: http://www.understudy.net/custom.html#Korn

AddThis Social Bookmark Button
Email this post


How to customize PS1 prompt in KSH?  

eg:

>[/current/dir] >
>
>I'd like it to be:
>[/current/dir]

edit your .profile

export PS1=[`hostname`:'$PWD]^V^J
>'
where ^V is control-V and ^J is control-J to accomplish this.

AddThis Social Bookmark Button
Email this post


How to replace ^M in unix to nothing?  

Monday, May 3, 2010

If you saw a lot of ^M character in your code, reason being is ^M is the character in DOS if you create the file in Windows.

If you transfer the DOS file into unix, you will see lots of ^M in your file and it is very irritating indeed.

You can do a simple magic in vi by

:%s/[crtl-v ctrl-m//g

meaning,
%s - substitute
[ctrl-v ctrl-m] - create the ^M character
// - empty
g - replace globally

AddThis Social Bookmark Button
Email this post


Design by Amanda @ Blogger Buster