Posted: Tue 08 Mar 2011, 00:57
Thanks Bruce. One can always learn new things every day here - even from the Beginner section
READ-ONLY Archive
https://oldforum.puppylinux.com/
Code: Select all
# shows full path at prompt
export PS1='[\w] '
# shows current directory
#export PS1='[\W] '
# moves back one directory
alias ..='cd ..'
# moves back two directories
alias ...='cd ../..'
# moves back three directories
alias ....='cd ../../..'
# to return to a saved directory, a script is needed
# but not yet included in this post
alias u='. /tmp/uu~'
# returns to last directory
alias b='cd -'
# refreshes .bashrc
alias rf='. ~/.bashrc'
# opens .bashrc for editing, the resources it
# use text editor of YOUR choice
alias eda='mp ~/.bashrc;. ~/.bashrc'
Code: Select all
#!/bin/bash
[ $1 ] && name=$1
[ ! $1 ] && name=`basename $PWD`
echo alias $name="'cd $PWD'">>/root/.bashrc
</root/.bashrc grep "$name"
Code: Select all
#!/bin/bash
[ $1 ] && name=$1
[ ! $1 ] && name=`basename $PWD`
echo alias $name="'cd $PWD'">>/root/.bashrc
</root/.bashrc grep "$name"
Code: Select all
#!/bin/bash
[ $1 ] && name=$1
[ ! $1 ] && name=`basename $PWD`
echo alias $name="'cd $PWD'">>/root/.bashrc
</root/.bashrc grep "$name"
Code: Select all
#!/bin/bash
echo cd $PWD>/tmp/uu~
Code: Select all
ndir() {
if [ $1 ] ; then
[ ! -d $1 ] && mkdir $1
cd $1
else
echo Missing argument
fi
}
Code: Select all
functionname() {
echo
}
You want to consider that many of us value your posts....and may not want to "jump in the middle" and disrupt your train of thought.Bruce B wrote:I have a sincere concern I want to express.
PupGeek started this topic with a great deal of interest.
Now I notice I'm the only one posting. I feel bad about that. The reason
why I feel bad is because I think unintentionally took other's interest in
posting. This is not OK with me.
~
I didn't consider that. Now I have a thought to work with I didn't havetlchost wrote: You want to consider that many of us value your posts....and may not want
to "jump in the middle" and disrupt your train of thought.
We're sitting on the sidelines monitoring for any malicious codeBruce B wrote:I didn't consider that. Now I have a thought to work with I didn't havetlchost wrote: You want to consider that many of us value your posts....and may not want
to "jump in the middle" and disrupt your train of thought.
before. To grow we need each other.
And I'd still feel better about this if PupGeek and others would resume their
interest. I'll wait and see.
Thanks
~
Code: Select all
#!/bin/bash
DESTPART=/dev/sda2
DESTDIR=rootbkup
FILENAME=bkuproot.zip
Code: Select all
</proc/mounts grep $DESTPART>/dev/null
Code: Select all
if [ "$?" = "0" ] ; then
[ ! -d $DESTPART/$DESTDIR ] && mkdir $DESTPART/$DESTDIR
Code: Select all
[ -f $DESTPART/$DESTDIR/$FILENAME ] && rm $DESTPART/$DESTDIR/$FILENAME
Code: Select all
zip -r9y $DESTPART/$DESTDIR/$FILENAME /root
Code: Select all
else
echo "$DESTPART is not mounted, no changes made"
Code: Select all
fi
Code: Select all
#!/bin/bash
DESTPART="/dev/sda2"
DESTDIR="rootbkup"
FILENAME="bkuproot.zip"
</proc/mounts grep $DESTPART>dev/null
if [ "$?" = "0" ] ; then
[ ! -d $DESTPART/$DESTDIR ] && mkdir $DESTPART/$DESTDIR
[ -f $DESTPART/$DESTDIR/$FILENAME ] && rm $DESTPART/$DESTDIR/$FILENAME
zip -r9y $DESTPART/$DESTDIR/$FILENAME /root
else
echo "$DESTPART is not mounted, no changes made"
fi
Code: Select all
#!/bin/bash
DESTPART="/mnt/sda2"
DESTDIR="rootbkup"
FILENAME="bkuproot.zip"
</proc/mounts grep $DESTPART>/dev/null
if [ "$?" = "0" ] ; then
[ ! -d $DESTPART/$DESTDIR ] && mkdir $DESTPART/$DESTDIR
[ -f $DESTPART/$DESTDIR/$FILENAME ] && rm $DESTPART/$DESTDIR/$FILENAME
zip -r9y $DESTPART/$DESTDIR/$FILENAME /root
else
echo "$DESTPART is not mounted, no changes made"
fi
Code: Select all
#!/bin/bash
</proc/mounts grep /mnt/sda2>/dev/null
if [ "$?" = "0" ] ; then
[ ! -d /mnt/sda2/rootbkup ] && mkdir /mnt/sda2/rootbkup
[ -f /mnt/sda2/rootbkup/bkuproot.zip ] && rm /mnt/sda2/rootbkup/bkuproot.zip
zip -r9y /mnt/sda2/rootbkup/bkuproot.zip /root
else
echo "/mnt/sda2 is not mounted, no changes made"
fi
try againjpeps wrote:maybe /dev/null. Worth a nickel?
Script will work from "/". Guess that's good enough, right?Bruce B wrote:try againjpeps wrote:maybe /dev/null. Worth a nickel?
Code: Select all
#!/bin/bash
main() {
vars
updateroot
updatemnt
filedatabase
}
vars() {
dbfile=/dev/shm/update.db
destdir=/var/log
# get list of directories off /
rootdirs=`find / -maxdepth 1 -type d | cut -c 2-100 \
| grep -v sys | grep -v 'lost+found' | grep -v mnt \
| grep -v proc | grep -v dev | tr "\n" " "`
# echo $rootdirs
# get mounted filesystems
mntdirs=`cat /proc/mounts | grep /mnt/ \
| cut -d " " -f 2 | tr "\n" " "`
# echo $mntdirs
}
updateroot() {
echo > $dbfile
for i in $rootdirs ; do
echo "updating /$i"
# nice --adjustment=+6 find /$i -mount -type f>>$dbfile
find /$i -mount -type f>>$dbfile
done
}
updatemnt() {
for i in $mntdirs ; do
echo "updating $i"
# nice --adjustment=+6 find $i -noleaf -mount -type f>>$dbfile
find $i -noleaf -mount -type f>>$dbfile
# break
done
}
filedatabase() {
mv $dbfile $destdir
}
main