Wednesday, July 21, 2010

Bash scripts to help with scala-console

  • alias nano 'nano EHimq' for better nano defaults in bashrc
  • mkdir ~/apps/scripts, cd  ~/apps/scripts
  • nano do-script
  • chmod u+x do-*
  • append to $Path in bashrc "~/apps/scripts"
  • run do-script to start appending the terminal to log file

  • run do-clean-log to clean the terminal log files to be cleaned

  • Custom prompt bash shell, edit /etc/bash.bashrc
    Append the code as follows
  • in ~/.bashrc file put this line at end export PS1="\\W \\$"
  • this will display prompt as "~ $ " (space is allowed anywhere, that is why double quotes :)



    # If id command returns zero, you’ve root access.
    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
    
  • to make the prompt setting permanent
    To have it set everytime you login to your workstation add above export command to your .bash_profile file or .bashrc file.


    $ cd
    $ vi .bash_profile
    OR
    $ vi .bashrc
    
    Append export line:
    export PS1="\e[0;31m[\u@\h \W]\$ \e[m"
    

    Save and close the file.

No comments: