xrogaan | yeh, -i means 'in place' | 04:09 |
---|---|---|
bgstack15 | One change I noticed recently, although I haven't tested it on Devuan, is that I could no longer use an exclamation point ! on a grep command at the end of a pipe. | 16:12 |
bgstack15 | dnf list installed | ! grep -q 'packagename' | 16:12 |
bgstack15 | started malfunctioning in AlmaLinux 8. | 16:12 |
fsmithred | bgstack15, is that in a test? | 16:16 |
fsmithred | I just tried it in beowulf and I get a syntax error message. | 16:16 |
bgstack15 | It was in a script of mine, that I use on the command line, that caches the output of yum/dnf. apt-get/dpkg caches stuff in a way that's way faster than yum. | 16:16 |
fsmithred | if dpkg -l | ! grep -q linux ; then echo not ; else echo yes ; fi | 16:17 |
fsmithred | bash: syntax error near unexpected token `!' | 16:17 |
bgstack15 | I haven't touched that script for years. | 16:17 |
bgstack15 | And then now it breaks. | 16:17 |
fsmithred | if ! dpkg -l | grep -q systemd ; then echo not ; else echo yes ; fi | 16:17 |
fsmithred | not | 16:17 |
bgstack15 | probably some change in bash or something. | 16:17 |
bgstack15 | The readability of your suggested line is not as good as the readability of: | 16:18 |
fsmithred | yeah, there have been a few. Changes in quoting with respect to spaces is different. Not sure what else. | 16:18 |
bgstack15 | dpkg -l | ! grep -q systemd | 16:18 |
fsmithred | for human readers, yeah. | 16:18 |
bgstack15 | I'm not trying to measure the response of "dpkg -l"; I want to know if the grep -q systemd failed. | 16:18 |
bgstack15 | Although pipes do funky things with exit codes. | 16:18 |
bgstack15 | And, as a side rant since it's mildly related: FRICK set -euo pipefail | 16:19 |
bgstack15 | Fails silently, no logging, no indication of which line was last executed, or even which part of a pipe executed. | 16:19 |
fsmithred | set +x help? | 16:19 |
* bgstack15 drops mic | 16:19 | |
bgstack15 | I _never_ use set -e, or pipefail in my scripts. I handle my errors. | 16:20 |
fsmithred | same here | 16:20 |
bgstack15 | Yeah, I probably need to read a bash changelog. | 16:21 |
fsmithred | the fix for my line above is to put the 'if' after dpkg. | 16:22 |
* fsmithred does not look forward to re-writing scripts. | 16:23 | |
_alv_ | ... | 16:34 |
golinux | Hi, _alv_ ! | 16:50 |
golinux | Thanks for hanging around. :) | 16:51 |
xrogaan | bgstack15: isn't the syntax '[!] command | command2' ? | 18:14 |
xrogaan | > If the reserved word ! precedes a pipeline, the exit status of that pipeline is the logical negation of the exit status as described above. | 18:15 |
bgstack15 | lol, that's the statement from the manual for bash. | 18:15 |
bgstack15 | I swear that my script had this (apparently now-invalid) syntax for years. | 18:15 |
bgstack15 | And I use this script weekly. | 18:15 |
xrogaan | you may have been silently running a buggy script for years :/ | 18:24 |
onefang | Maybe try it on a live ancient Devuan? | 18:24 |
xrogaan | bgstack15: it's breaking (syntax error) because of histexpand | 18:39 |
xrogaan | it has to be something related to histexpand | 18:40 |
fsmithred | Enable ! style history substitution. | 18:41 |
fsmithred | ^^^ what does that mean??? | 18:41 |
xrogaan | call previously sent commands | 18:45 |
fsmithred | yeah, I've only used it with numbers. Still reading. | 18:45 |
xrogaan | '!echo' will search the history for the first command command starting with 'echo' | 18:45 |
xrogaan | bgstack15: I'm unsure if your line was valid or not. Why not post to help-bash and ask for clarification? | 18:49 |
fsmithred | Start a history substitution, except when followed by a blank, newline, carriage return, = or ( | 18:49 |
Xenguy | fsmithred, Is there a man page, or ...? | 18:53 |
fsmithred | man bash | 18:53 |
fsmithred | fine reading | 18:53 |
Xenguy | Ohhh | 18:54 |
Xenguy | That's a long man page IIRC = ) | 18:54 |
fsmithred | yeah, it's more than one page | 18:54 |
Xenguy | The other infamous man page that comes to mind is 'rsync' 8 -) | 18:54 |
xrogaan | you can also consult https://www.gnu.org/software/bash/manual/bash.html | 18:56 |
bgstack15 | And not only is `bash(1)` really long, it's a GNU thing, which is still fascinated with info iirc, so I'm guessing the info page for bash is even longer. | 19:01 |
gnu_srs | I think I'll retire build005 anyway, memory on that box is a little scarce. | 23:17 |
gnu_srs | It's not utilized now and if you want I can provide a build host on another (faster) box with more memory. | 23:17 |
Generated by irclog2html.py 2.17.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!