but try this
while true; do ps | grep X | grep -v 'grep'; S="/bin/sleep 0.2"; "$S" ;done
and this
Code: Select all
while true; do ps | grep X | grep -v 'grep'; S="/bin/sleep 0.2"; $S ;done
Code: Select all
while true; do ps | grep X | grep -v 'grep'; S="/bin/sleep 0.2"; $S ;done
Code: Select all
#!/bin/bash
cd /
# It is a good habit to quote filenames. $i would have a filename. It isCode: Select all
for i in *.deb do undeb "$i" #It is a good habit to quote variables. shift done
Code: Select all
#/bin/bash
for i in *
do
echo $i | grep " "
echo $i | grep __
echo $i | grep \'
echo $i | grep "?"
echo $i | grep "("
echo $i | grep ")"
echo $i | grep "&"
echo $i | grep ","
echo $i | grep "!"
done
Code: Select all
mkdir -p /mnt/sda1/lupu52/backup/2010
Code: Select all
shopt -s cdspell
Who are you talking to?smallfish wrote:This is intended to introduce beginners to the shell
and scripts so that they may begin experiencing the true power of Linux.
Bruce, would you be sharing how to do it in a better way? .Bruce B wrote:source r should achieve the same results
When done, delete the file r, it's purpose is served
and I will show you a much better way.
~
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
}