/srv/irclogs.ubuntu.com/2022/02/10/#ubuntustudio-devel.txt

krytarikEickmeyer: Regarding your latest -default-settings commit, while amending the commands for testing here due to not having any lowlatency kernels installed.. '_lowLatencyKernels=$(ls /boot/vmlinuz-*); _lowLatencyArray=("${_lowLatencyKernels[@]}"); echo "${_lowLatencyArray[-1]}"' outputs "/boot/vmlinuz-5.15.0-2-amd64" and "/boot/vmlinuz-5.15.0-3-amd64" here, while just ...17:48
krytarik... '_lowLatencyKernels=(/boot/vmlinuz-*); echo "${_lowLatencyKernels[-1]}"' correctly outputs "/boot/vmlinuz-5.15.0-3-amd64" - also you wrote "lastest" in the comment. XD17:48
Eickmeyerkrytarik: Ooops17:49
Eickmeyerkrytarik: No? It uses ls /boot/vmlinuz-*-lowlatency17:50
Eickmeyerback later17:50
krytarikThe point being you can just skip 'ls' here and put the file paths in an array directly.17:51
krytarikAnd due to the quoting you are doing in the middle step currently, the whole 'ls' output ends up as a single element in the array.17:54
krytarikWhich also makes the result completely invalid as an argument to the 'touch' command, because it contains a newline character in between those two file paths as in my case.17:58
krytarikls: cannot access '/boot/vmlinuz-5.15.0-2-amd64'$'\n''/boot/vmlinuz-5.15.0-3-amd64': No such file or directory -- like this, while just using 'ls' for testing here of course.18:01
Eickmeyerkrytarik: I understand I could avoid LS, but I use shellcheck for best practices and it says that's not a good idea.18:37
EickmeyerEither way, removed the quote which should fix the problem. BUT, I will not remove ls.18:38
krytarikInteresting that shellcheck differs there on what's otherwise pretty widely known as bad practice.. :318:42
EickmeyerEveryone has different coding styles. :P18:46
krytarikI mean a glob like "/boot/vmlinuz-*-lowlatency" on its own already gets expanded to any paths that actually exist, and throwing in a command to list them so the output can be parsed back into the bare paths just makes things unnecessarily inefficient and more error-prone..18:53
krytarikhttps://stackoverflow.com/questions/10981439/reading-filenames-into-an-array - example commentary on this I've just found.18:55
EickmeyerVery weird that shellcheck doesn't recognize that.18:57
Eickmeyerkrytarik: I did your thing, it works, pushed.22:05
EickmeyerAnd shellcheck liked it this time.22:05
krytarikHuh..22:07
EickmeyerYeah, before I was leaving a $ before the ( which caused it to freak.22:11
EickmeyerSo, mea culpa.22:11
krytarikAh yeah, that makes sense then!22:12

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!