- 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters#!/bin/bash givenDir=$(basename $PWD) echo $givenDir logFile=~/work/logs/term-${givenDir}.log script -afq $logFile
- run do-clean-log to clean the terminal log files to be cleaned
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters#!/bin/bash logDir=~/work/logs #find $logDir -type f -name '*.log' | xargs echo $1 shopt -s nullglob for f in $(find $logDir -type f -name '*.log') do echo $f sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" $f > ${logDir}/temp.txt cp ${logDir}/temp.txt $f done
- 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.
Wednesday, July 21, 2010
Bash scripts to help with scala-console
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment