📄 syn-func.sh
字号:
#!/bin/bash# Functions in support of syntax tests# Source this file.declare -a GOODGOOD_N=0declare -a BADBAD_N=0function fname{ local BASE="$1" # Base local N="$2" # Number local EXT="$3" # Extension [ "$EXT" = "" ] && EXT="rq" echo $(printf "$BASE%02d.$EXT" $N)}# reads from stdinfunction testGood{ local FN="$1" local I=${#GOOD[*]} GOOD[$I]=$FN cat > $FN}# reads from stdinfunction testBad{ local FN="$1" local I=${#BAD[*]} BAD[$I]=$FN cat > $FN}function clean{ rm -f *.rq rm -f *.arq rm -f *.ttl}function createManifest{ local LABEL="$1"## Header cat > manifest.ttl <<EOF@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .@prefix mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> .@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .<> rdf:type mf:Manifest ; rdfs:comment "Syntax tests $LABEL" ; mf:entries ( EOF # Queries good syntax for f in "${GOOD[@]}" do cat >> manifest.ttl <<EOF [ mf:name "$f" ; rdf:type mfx:TestSyntax ; mf:action <$f> ; ]EOF done # Queries - bad syntax for f in "${BAD[@]}" do cat >> manifest.ttl <<EOF [ mf:name "$f" ; rdf:type mfx:TestBadSyntax ; mf:action <$f> ; ]EOF done## Trailer cat >> manifest.ttl <<EOF ) .EOF}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -