Syntax-Kamelon
view release on metacpan or search on metacpan
t/Bench/samples/highlight.sh view on Meta::CPAN
echo \(output\) \&\| \> \< \" \' \*
# variable substitution:
$filename.ext
$filename_ext
${filename}_ext
text${array[$subscript]}.text
text${array["string"]}.text
${!prefix*}
${!redir}
short are $_, $$, $?, ${@}, etc.
${variable//a/d}
${1:-default}
# expression subst:
$(( cd << ed + 1 ))
# command subst:
$(ls -l)
echo `cat myfile`
# file subst:
$(<$filename)
$(</path/to/myfile)
# process subst:
sort <(show_labels) | sed 's/a/bg' > my_file.txt 2>&1
# All substitutions also work in strings:
"subst ${in}side string" 'not $inside this ofcourse'
"The result is $(( $a + $b )). Thanks!"
"Your homedir contains `ls $HOME |wc -l` files."
# Escapes in strings:
p="String \` with \$ escapes \" ";
# keywords are black, builtins dark purple and common commands lighter purple
set
exit
login
# Other colorings:
error() {
cat /usr/bin/lesspipe.sh
runscript >& redir.bak
exec 3>&4
}
# do - done make code blocks
while [ $p -lt $q ]
do
chown 0644 $file.$p
done
# braces as well
run_prog | sort -u |
{
echo Header
while read a b d
do
echo $a/$b/$c
done
echo Footer
}
# Any constructions can be nested:
echo "A long string with $(
if [ $count -gt 100 ] ; then
echo "much"
else
echo "not much"
fi ) substitutions." ;
# Even the case construct is correctly folded:
test -f blaat &&
( do_something
case $p in
*bak)
do_bak $p
;;
*)
dont_bak $p
;;
esac
) # despite the extra parentheses in the case construction.
# variable assignments:
DIR=/dev
p=`ls`
LC_ALL="nl" dcop 'kate*'
_VAR=val
ARR=(this is an array)
ARR2=([this]=too [and]="this too")
usage="$0 -- version $VERSION
Multiple lines of output
can be possible."
# Some commands expect variable names, these are colored correctly:
export PATH=/my/bin:$PATH BLAAT
export A B D
local p=3 x y='\'
read x y z <<< $hallo
unset B
declare -a VAR1 VAR2 && exit
declare less a && b
# options are recoqnized:
( run in 0.504 second using v1.01-cache-2.11-cpan-5511b514fd6 )