Hi all
my my, I just uplaoded an outdated bash script. kindly use the one below (for
those of you that wonder what was wrong with the first one: in the master file
function edtitmaster
correct line
cat $1$ext | sed "s/$nextsub/O <$sub> call $sub\\n$nextsub/g" > 123456789
wrong line was
cat $1$ext | sed "s/$nextsub/O <$sub> label $sub\\n$nextsub/g" > 123456789
#! /bin/bash
##################################################################
#
# Parameters:
# 1 masterfile
# 2 subfile
#
##################################################################
ext=.ngc
nextsub="(###nextsub############################################)"
##################################################################
editsub() {
# if there is other code to be checked, removed or altered,
# code should go here
echo "O <$2> sub" > $2$ext
cat $1 | sed "/M30/d" >> $2$ext
echo "O <$2> endsub" >> $2$ext
echo "M2" >> $2$ext
}
##################################################################
mkmasterskeleton () {
echo $1$ext
echo "(******************************************************)" \
> $1$ext
echo "( Run all seperate tasks in one master file )" \
>> $1$ext
echo "(******************************************************)" \
>> $1$ext
echo "" >> $1$ext
echo "$nextsub" >> $1$ext
echo "" >> $1$ext
echo "(******************************************************)" \
>> $1$ext
echo "( Back home )" \
>> $1$ext
echo "(******************************************************)" \
>> $1$ext
echo "M5 (Spindle off)" >> $1$ext
echo "M9 (Coolant off)" >> $1$ext
echo "G21 (dimensions mm)" >> $1$ext
echo "G53 G0 Z210 (lift spindle to max)" >> $1$ext
echo "G53 G0 x1900y500 (goto where I want you to)" >> $1$ext
echo "(* end of job *****************************************)" \
>> $1$ext
}
##################################################################
editmaster () {
cat $1$ext | sed "s/$nextsub/O <$sub> call $sub\\n$nextsub/g" > 123456789
rm $1$ext
mv 123456789 $1$ext
}
# main ###########################################################
sub=$(echo "sub_"$2 | sed "s/.ngc//g" )
master=$(echo $1 | sed "s/.ngc//g" )
if [ -f $sub$ext ]
then
echo "file $sub$ext already exists. "
exit 1
else
editsub $2 $sub
fi
if [ -f $master$ext ]
then
if [ $(cat $master$ext | grep $sub) ]
then
echo "$sub already in $master:"
cat $master$ext | grep $sub
exit 1
else
editmaster $master $sub
fi
else
mkmasterskeleton $master
editmaster $master $sub
fi
exit 0
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen
Massenmails.
http://mail.yahoo.com
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users