Skip to content

Instantly share code, notes, and snippets.

@sgnyjohn
Created July 15, 2019 14:59
Show Gist options
  • Save sgnyjohn/693a7799ab1f8f1e62aca5ba09fdaf8d to your computer and use it in GitHub Desktop.
Save sgnyjohn/693a7799ab1f8f1e62aca5ba09fdaf8d to your computer and use it in GitHub Desktop.
source code editor
#!/bin/bash
drJ=$HOME/prg/java
maxArq=10
param="$1"
if [ 0$1 -ge 1 ]; then
maxArq=$1
echo "maxArq=$maxArq"
shift
param=$1
else
echo nao
fi
#limpa arquivos
if [ 1 -eq 1 ]; then
dr="$HOME/java/geanyConf"
xx="$dr/geany.conf"
[ test -e $xx.bak ] && [ rm -f $xx.bak ]
cat $xx | egrep -v ^recent_files= | egrep -v ^recent_projects= | egrep -v ^current_page= | egrep -v ^FILE_NAME_ >$xx.lixo
mv $xx $xx.bak
mv $xx.lixo $xx
ED="geany -c $dr"
fi
#arq temp
aq=/tmp/jew.txt
test -e $aq && rm -f $aq
naq=1
######################
######################
procDir() {
dr="$1"
#cd $dr
#echo "dr=$dr"
#read
aq1=$aq$naq.txt
naq=$[naq+1]
shift
while ! test -z $1; do
find "$dr" -name "*.$1" -printf "%T@\t%P\n" >$aq1
#joga pro arq principal
exec 9<&0 <$aq1
nv=0
while read DT NOM; do
aa=$dr/$NOM
#le o link e data correta...
if test -h "$aa"; then
cd $(dirname $aa)
aa=$(readlink -f $aa)
DT=$(find "$(dirname $aa)" -name "$(basename $aa)" -printf "%T@")
echo "link **** $NOM link aa=$aa DT=$DT"
xx=
fi
echo -e "${DT}\t$aa" >>$aq;
nv=$[nv+1]
done
echo "*************** $nv *.$1 $dr"
shift
done
#echo "fim dr=$dr"
#read
}
######################
######################
#exit
if [ ".$param" == "." ]; then
procDir /home/signey/prg/java/ java xml
procDir /home/signey/prg/paginas/js/ js xhtml
elif [ 1 -eq 1 ]; then ##[ ".$2" == "." ]; then
while [ ".$param" != "." ]; do
procDir "$param" php
procDir "$param" js
procDir "$param" html
shift
done
fi
######################
### fim
rd="";
n=0;
##ORDENA
#cat $aq | sort -r >${aq}.txt
cat $aq | sort | tail -n $maxArq >${aq}.txt
##MONTA STRING
exec 9<&0 <${aq}.txt
while read DT NOM ; do
echo "$NOM $DT";
if [ $n -eq $maxArq ]; then
break;
elif [ "$NOM" == "" ] ; then
echo "**NOM vazio $DT"
else
rd="$rd $NOM";
n=$[n+1];
fi
done
echo "rd=$rd"
echo "aq=${aq}.txt"
$ED $rd &
echo "$n $rd $n"
exit
#antigo
x=`php /home/signey/bin/ePrg.php . /home/signey/dados/web`
scite $x &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment