Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
databasher
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
1.
▲
by
databasher
2y ago
With lines.txt: printf '(%s)\n' "one two" "three four five" echo "How you doin'?" Running: while read -r line; do eval command=($line) command+=("arg with spaces" &
2.
▲
by
databasher
2y ago
Bash handles spaces just fine. # store the command in an array X=(echo "A B") # execute the command "${X[@]}" Yields: A B
3.
▲
by
databasher
3y ago
Meanwhile, UPS's web site has mostly gone down. Their home page now reads "Sorry! We Can’t Find That Page. Looks like the page you’re trying to find may have been moved or deleted."
4.
▲
by
databasher
4y ago
The video in the linked page says that getopts only supports short options.
5.
▲
by
databasher
4y ago
If you refer to my example above, you'll find that Bash's native "getopts" handles long options just fine. It accepts short option `-`, with an argument. This handles --long-options and --long-options=with-arguments. Fee
6.
▲
by
databasher
4y ago
Handling command-line arguments in Bash is easy. Bash's `getopts` handles short and long arguments gnu-style without any problem, out of the box, without any need for libraries or complicated packages. This pattern handles lots of styl
7.
▲
by
databasher
5y ago
It turns out they are very similar to binary loadlifters in most respects.
8.
▲
by
databasher
5y ago
Bash `getopts` handles short and long arguments gnu-style without any problem. The following code handles args like "-h", "-i $input-file", "-i$input-file", "--in=$input-file", and "--help":
9.
▲
by
databasher
6y ago
Thanks!
10.
▲
by
databasher
6y ago
Like @bxparks, I have a template for my bash scripts command-line parsing, but I like to stick to GNU-style options and I find that Bash's getopts command handles all these cases without trouble: command -ffilename -f filename --file=f
11.
▲
by
databasher
6y ago
It would not be difficult. Nuclear reactors could provide power almost indefinitely. Greenhouses could maintain plant life. Animals could be bred and slaughtered. A quick survey would have to be made of all the suitable mine sites in the
12.
▲
by
databasher
6y ago
I use GraphViz to produce a visual, browsable version of the NIEM data model. GraphViz can output images and HTML maps, which allows easy building of clickable web pages with hover notes. See the diagram at https://niem.github.io
13.
▲
by
databasher
6y ago
My go-to would be tar: `$ tar -C $source-dir -c . | tar -C $dest-dir -x`
14.
▲
by
databasher
7y ago
Why not use bash's printf %q? string=$(printf ' %q' "${array[@]}")
15.
▲
by
databasher
7y ago
Pandoc calls these "Line blocks": https://pandoc.org/MANUAL.html#line-blocks
16.
▲
by
databasher
7y ago
TCL had an amazing architecture for someone who was working in C. In C, you'd (1) create an instance of a TCL interpreter, (2) register your C functions with the TCL interpreter, and then (3) load scripts into the TCL interpreter. You&