Linux

linux

Bash syntax highlighted script

As I said to you, I have done the bash highlighted syntax script, Still it does not highlight many words, but I will try to improve it. If there is some word that is not highlighted, simply add it to the variable KeyWords. Here the code: #!/bin/bash rutaCodigo=`zenity --file-selection --title="Select a File"` case $? in 0) keywords="alias bg bind break builtin case cd command continue declare dirs disown do done echo elif else enable-in esac eval exec exit export fc fg fi for function getopts hash help history if in jobs kill let local logout popd pushd pwd read readonly return select set shift suspend test then time times trap type typeset ulimit umask unalias unset until wait while sed rm IFS cp mv mkdir" sed 's/#.

linux

Bash syntax highlighted script [Improved]

Thanks to DavidRSM, I have improved the highlighted syntax script for bash, and now it allows many more key words. Simply it is necessary to add to the variable keywords the commands names that they find in /bin/, and /sbin/, You can add more key words concatenating them to the variable, this way: keywords=$keywords`ls 'Commands directory'` #!/bin/bash rutaCodigo=`zenity --file-selection --title="Select a File"` case $? in 0) keywords="alias bg bind break builtin case cd command continue declare dirs disown do done elif else enable-in esac eval exec exit export fc fg fi for function getopts hash help history if jobs let local logout popd pushd read readonly return select set shift suspend test then time times trap type typeset ulimit umask unalias unset until wait while" #Agrego mas palabras clave de los directorios sbin y bine, que contienen comandos.

linux

C++ syntax highlighted script

I decided to create a small script that highlights the words reserved of c++. Here the code: #!/bin/bash rutaCodigo=`zenity --file-selection --title="Select a File"` case $? in 0) keyWords="continue float new signed try auto default for operator sizeof typedef break delete friend private static union case do goto protected struct unsigned catch double if public switch virtual char else inline register template void enum int return this volatile const extern long short throw while bool cout cin using namespace" sed "s/^#include/#include/" < "$rutaCodigo" > temp # coloreo el include sed "s/^#define/#define/" < temp > "$rutaCodigo" # coloreo el define for word in $keyWords do #Busco en el texto, cada palabra clave contenida en keyWords, y le añado la etiqueta span sed "s/b$wordb/$word/" < "$rutaCodigo" > temp cp temp $rutaCodigo done sed "s/^class /class/g" < "$rutaCodigo" > temp rm temp ;; *) echo "No se seleciciono nada.