# .bashrcPS1="\[\033[0;0m\](\[\033[1;34m\]\d \T \u@\h \[\033[1;31m\]\w\[\033[0;0m\])\n\[\033[0;0m\](\[\033[0;36m\]Yes, my Master?\[\033[0;0m\]) \[\033[0;0m\]"################################################### User Aliases defined here (in alphabetic order)##################################################alias cdk="cd /kdata/2006/"alias cdp="cd /kdata/practice/users/aaron/"alias cp="cp -i"alias la="ls -aF --color=tty"alias ll="ls -lrt --color=tty"alias ls="ls --color=tty"alias mv="mv -i"alias p="pwd"alias rm="rm -i"alias xd="mkdir $LOGNAME; cd $LOGNAME"alias fonebuild="fonebuld"alias super="cd ~;/cfmc/go/super;cd -"################################################### User Scripts defined here (in alphabetic order)##################################################dtst(){ project="$1" # project number should be first argument if [[ $# == 0 ]]; then # check the number of command line arguments echo "ERROR: Please supply project number" echo "Required usage: dtst 0536" echo "Required usage: dtst 0536 2005" elif [[ $# == 1 ]]; then proj_year=$(date +%Y) else proj_year="$2" fi gose ${project} # go to the setup directory of the project demo_dirs=$(ls -d demo*/ | wc -l) # store the number of demo directories if [[ ! -d /kdata/${proj_year}/${project}/setup/${LOGNAME} ]]; then # if the user tesing directory does not exist mkdir ${LOGNAME} # make the user testing directory fi cd ${LOGNAME} # change to the user testing directory if [[ demo_dirs == 1 ]]; then cp -f ../demo/*.qpx . # copy the qpx from first demo directory else cp -f ../demo${demo_dir}/*.qpx . # copy the qpx from latest demo directory fi ment ${project} # compile the project surv ${project} # execute the survey}fonebak(){ project="$1" # project number should be first argument # takes at most 1 argument if [[ $# == 0 ]]; then # check the number of command line arguments echo "ERROR: Please supply project number and/or project year for backing up the phone files" echo "Required usage: fonebak 0536" echo "Optional usage: fonebak 0536 2005" elif [[ $# == 1 ]]; then proj_year=$(date +%Y) # system year in 4-digit format (2005) else proj_year="$2" # user-defined year fi cd /kdata/${proj_year}/${project}/setup # goto project dir cp -f p${project}.fon p${project}.bkn # create backups of phone files cp -f p${project}.fnx p${project}.bkx cd /cfmc/fone # goto live phone dir cp -f p${project}.fon p${project}.bkn # create backups of latest phone files cp -f p${project}.fnx p${project}.bkx cp -f p${project}.fon p${project}.fnx /kdata/${proj_year}/${project}/setup/ # copy the latest phone files to setup dir cd /kdata/${proj_year}/${project}/setup # goto project dir}goda() # goes to the data dir{ # takes at most 1 argument project="$1" # project nummber should be first argument proj_year=$(date +%Y) # project year set to the 4-digit current year if [[ $# == 0 ]]; then # check for the number of command line arguments echo "ERROR: Please supply project number and/or project year" echo "Required usage: goda 0536" echo "Optional usage: goda 0536 2005" else # if the argument exists cd /kdata/${proj_year}/${project}/data # change to the project data directory fi}gord() # goes to the rdg dir{ # takes at most 3 arguments project="$1" # project number should be first argument if [[ $# == 0 ]]; then # check for the number of command line arguments echo "ERROR: Please supply project number and/or project year and/or rdg number" echo "Required usage: gord 0536" echo "Optional usage: gord 0536 2005 (project number and year)" echo "Optional usage: gord 0536 2 (project number and rdg dir number)" echo "Optional usage: gord 0536 2005 2 (proect number and year and rdg dir number)" elif [[ $# == 1 ]]; then # if 1 argument exists proj_year=$(date +%Y) # project year is current year cd /kdata/${proj_year}/${project}/rdg # change to the project rdg directory elif [[ $# == 2 ]]; then # if 2 arguments exist if [[ ${#2} == 4 ]]; then # if the length of the 2nd argument is 4 digits proj_year="$2" # set the project year to the 2nd argument cd /kdata/${proj_year}/${project}/rdg else proj_year=$(date +%Y) # set the project year to current year rdg_numb=$2 # set the rdg dir to the 2nd argument cd /kdata/${proj_year}/${project}/rdg${rdg_numb} # change to the addl project rdg dir fi else proj_year="$2" # set the project year to the 2nd argument rdg_numb="$3" # set the addl rdg dir to the 3rd argument cd /kdata/${proj_year}/${project}/rdg${rdg_numb} # change to the addl project rdg dir fi}gosa() # goes to the sample directory{ # takes at most 3 arguments project="$1" # project number should be first argument if [[ $# == 0 ]]; then # check for the number of command line arguments echo "ERROR: Please supply project number and/or project year and/or addl sample date" echo "Required usage: gosa 0536" echo "Optional usage: gosa 0536 2005 (project number and year)" echo "Optional usage: gosa 0536 0615 (project number and addl sample date)" elif [[ $# == 1 ]]; then # if 1 argument exists proj_year=$(date +%Y) # project year is current year cd /kdata/${proj_year}/${project}/sample # change to the project sample directory elif [[ $# == 2 ]]; then # if 2 arguments exist if [[ $2 = 2* ]]; then # if the first character of the 2nd argment is a 2 proj_year="$2" # set the project year to the 2nd argument cd /kdata/${proj_year}/${project}/sample # change to the project sample dir else proj_year=$(date +%Y) # else set project year to current year addl_samp="$2" # set the addl sample dir to 2nd argument cd /kdata/${proj_year}/${project}/sample/${addl_samp} # change to the project addl sample dir fi else proj_year="$2" # set the project year to the 2nd argument addl_samp="$3" # set the addl sample dir to the 3rd argument cd /kdata/${proj_year}/${project}/sample/${addl_samp} # change to the project addl sample dir fi}gose() # goes to the setup directory{ # takes at most 3 arguments project="$1" # project number should be first argument user_dir="$LOGNAME" # user testing directory is set to username if [[ $# == 0 ]]; then # check the number of command line arguments echo "ERROR: Please supply project number and/or project year" echo "Required usage: gose 0536" echo "Required usage: gose 0536 mon (project number and tracking day)" echo "Optional usage: gose 0536 2005 (project number and year)" elif [[ $# == 1 ]]; then # if 1 argument exists proj_year=$(date +%Y) # project year is current year cd /kdata/${proj_year}/${project}/setup # change to the project setup directory elif [[ $# == 2 ]]; then # if 2 arguments exist if [[ $2 = s* || $2 = m* || $2 = t* || $2 = w* || $2 = f* ]]; then # if the first character of the 2nd argment is a day of week track_day="$2" # set the tracking day to the 2nd argument proj_year=$(date +%Y) # set the project year to the current year cd /kdata/${proj_year}/${project}/setup/${track_day} # change to the project setup tracking dir else proj_year="$2" # set the project year to the 2nd argument cd /kdata/${proj_year}/${project}/setup # change to the project setup dir fi else proj_year="$2" # set the project year to the 2nd argument track_day="$3" # set the tracking day dir to the 3rd argument cd /kdata/${proj_year}/${project}/setup/${track_day} # change to the project setup tracking dir fi}ment() # goes to the project dir and compiles the QPX{ # takes at most 1 argument project="$1" # project number should be first argument if [[ $# == 0 ]]; then # check the number of command line arguments echo "ERROR: Please supply project number" echo "Required usage: ment 0536" else mental ${project} # compile the QPX fi}ptst() # test the survey provided by the argument{ # takes at most 1 argument project="$1" # project number should be first argument if [[ $# == 0 ]]; then # check the number of command line arguments echo "ERROR: Please supply project number" echo "Required usage: ptst 0536" elif proj_year="$2" gose ${project} # go to the setup directory of the project if [[ ! -d /kdata/${proj_year}/${project}/setup/${LOGNAME} ]]; then # if the user tesing directory does not exist mkdir ${LOGNAME} # make the user testing directory fi cd ${LOGNAME} # change to the user testing directory if [[ -f ../p${project}.fon -a -f ../p${project}.fnx ]]; then # if the fone files exist cp -f ../p${project}.f* . # copy the fone files from setup fi cp -f ../*.qpx . # copy the qpx from setup ment ${project} # compile the project surv ${project} # execute the survey fi}surv() # execute a specified survey{ # takes at most 1 argument project="$1" # project number should be the first argument if [[ $# == 0 ]]; then # check the number of command line arguments echo "ERROR: Please supply project number" echo "Required usage: surv 0536" else survent con con "INIT:p${project};$INITIALS;y;>faketime 7:00pm;y;" # execute the survey provided each user fi}