•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 363,779 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,579 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
This code changes color of prompt according to user, suppose if user is root then color would be red and normal user would have color black. This'll diffrentiate in users.
if [ $(id -u) -eq 0 ]; then # you are root, set red colour prompt PS1="\[$(tput setaf 1)\]\u@\h:\w #\[$(tput sgr0)\]" else # normal PS1="\u@\h:\w $" fi
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)