glob is not, and much more limited than, RegEx
Assuming a1.txt and a2.txt exists in current folder.
In addition to * and ?:
square bracket for range: [] range of characters
ls a[1-3].txt # output a1.txt a2.txt
also [[:lower:]] upper alnum alpha blank digit punct space xdigit
exclamation mark for Complementation !: for single char, not 1 and not 2
ls a[!12].txt # output cannot access 'a[!12].txt'
curly braces: no space allowed in {}
ls -l a{1,2,3}.txt # same as ls -l a1.txt a2.txt a3.txt
I feel this is brace expansion, instead of globbing since nothing to do with file existence
All posts for the month March, 2022
shell glob
Posted by Rio Wing on March 27, 2022
https://riowingwp.wordpress.com/2022/03/27/shell-glob/
SDI
Serial digital interface uses BNC connector with coaxial cable.
For professionals
HDSDI can do 1.5 Gbit/second, 100 meters, for broadcast, up to 1080p
also 12G-SDI
Comparing to HDMI:
longer distance. HDMI about 10m
connector strong and secure: HDMI cannot lock.
No HDCP
There are Converters between the two
Posted by Rio Wing on March 20, 2022
https://riowingwp.wordpress.com/2022/03/20/sdi/
compiledb
A minimum compile_commands.json
The project: proj\Console\bryan cross compiled on WSL1 to generate executable for arm/linux
To Install:
$ pip install compiledb #no sudo needed
To generate this .json file:
$ compiledb make -f makebryan
makebryan is the makefile similar to the one posted on 220227
To use this .json for vsCode intellisense:
add file name to \bryan\make.vscode\c_cpp_properties.json around here:
json.configurations[].compileCommands being compile_commands.json
The file structure: array with each element being a compiling unit. compile_commands.json:
[
{
"directory": "/mnt/s/rio/proj/Console/bryan/make",
"arguments": [
"/mnt/s/Rio/arm-mySample-linux-gnueabi/gcc-8/20190523/bin/arm-linux-g++",
"-g",
"-c",
"bryan.cpp",
"-o",
"../tmp/bryan.o",
"-I../incl"
],
"file": "bryan.cpp"
},
{
"directory": "/mnt/s/rio/proj/Console/bryan/make",
"arguments": [
"/mnt/s/Rio/arm-mySample-linux-gnueabi/gcc-8/20190523/bin/arm-linux-g++",
"-g",
"-c",
"bryan2.cpp",
"-o",
"../tmp/bryan2.o"
],
"file": "bryan2.cpp"
}
]
Posted by Rio Wing on March 13, 2022
https://riowingwp.wordpress.com/2022/03/13/compiledb/
getopts
Parsing bash script parameters, as below:
Expected pameters: -a -b must have parameter like aV bV, -c has no parameter, -d is invalid as not lised in getopts’s first argument string
Code: opt.sh
TestGetOpts()
{
while getopts ":a:b:c" opt; do #":a:"
case $opt in
a)
echo "-$opt received with value $OPTARG" >&2
;;
b)
echo "-$opt received with value $OPTARG" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
:)
echo "Option -$OPTARG requires an argument." >&2
;;
esac
echo -e "done opt=$opt OPTARG=$OPTARG \n"
done
}
TestGetOpts $@
Command line:
$ ./opt.sh -a aV -c -d -b
Output:
-a received with value aV # all good as expected
done opt=a OPTARG=aV
done opt=c OPTARG= # all good as expected as c doesn't expect parameter
Invalid option: -d # d not valid as it's not in ":a:b:c"
done opt=? OPTARG=d
Option -b requires an argument. # some value has to follow -b as indicated by "b:"
done opt=: OPTARG=b
Posted by Rio Wing on March 6, 2022
https://riowingwp.wordpress.com/2022/03/06/getopts/