Linux CLI
~/bin/showlevel (alias l=’showlevel’)
#!/bin/perl -w
my $pwd=`pwd`;
my @parts = split("/", $pwd);
my $level = (scalar(@parts)-1);
# Want to show which directory we are going to
$level--;
print $pwd;
my $last_index = 0;
my $index = 0;
while( $index != -1 && $level >= 1)
{
$index = index($pwd, "/", $index);
my $space = "";
my $double_digit_level = 0;
# Needs to be 8 because we print the spacer first
if( $level > 8 )
{
$double_digit_level = 1;
}
for( $i=0; $i < ($index - $last_index)-1; $i++)
{
if($double_digit_level)
{
# When we print the double digit level, we need to
# leave off on "spacer"
$double_digit_level = 0;
}
else
{
$space.=".";
}
}
if($index != -1)
{
print $space.$level;
$last_index = $index;
$index++;
$level--;
}
}
print "\n";
~/.profile
echo "Setting .profile"
umask 002
stty erase ^H
stty sane
set -o vi
PS1="[$LOGNAME@$(uname -n)("'${CLEARCASE_ROOT##*/}'")]"'${PWD#${PWD%/*/*}/}'"\$ "
#set display variable
if [[ -z $DISPLAY ]]
then
mytty=`tty | sed 's/\/dev\///'`
mydisp=`who | grep "$mytty " | grep ")" | sed 's/^.*(\(.*\))$/\1/'`
mydisp=$(echo $mydisp | cut -d. -f1)
export DISPLAY="$mydisp":0.0
else
echo Display :: $DISPLAY
fi
export DEFAULT_DISPLAY=$DISPLAY
echo Display set to $DISPLAY
export PATH=".:${HOME}/bin:${PATH}"
alias ls='ls --color=tty'
alias la='ls -al'
alias lt='ls -rot'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
alias vi=/usr/bin/vim
function k
{
if [[ -n $1 ]]; then
level=$1
else
level=1
fi
cdback=""
for ((i=0;i<level;i++))
do
cdback=$cdback"../"
done
cd $cdback
}