You are not logged in.
Hi! I wrote a little systemd-boot configurator script called sbc. Its version number is 0.1.0
Just a hobby, won’t be big and professional like GNU GRUB Customizer.
But seriously, I would be considered as "doesn't know shell scripting" and I made this script just for fun and learning.
Anyway the script:
https://github.com/betseg/sbc
Last edited by betseg (2016-01-06 22:32:47)
Offline
That looks like a nice learning project. It initially struck me as an odd goal - I'm dubious on the function this serves for users. But in skimming through it, it is very well organized and clearly coded. It looks like great shell scripting to me.
I'd suggest noting the license at the top of the .sh file, and it is common practice to note the license in version output like your function on line 33 (e.g. see `bash --version`).
You could likely simplify things like the pipeline on line 51 to be a single awk command. Also, there doesn't seem to be a reason to run that pipeline in a subshell and store the output to a variable only to echo that variable. Just run that pipeline in the current shell.
EDIT: example for the last suggetion: the following two code snippets do the exact same thing, but the first requires the spawning of a new instance of bash, the second does not:
option=$(grep ${selected_option} ${file} | expand | tr -s ' ' | cut -d ' ' -f2-)
echo $option
grep ${selected_option} ${file} | expand | tr -s ' ' | cut -d ' ' -f2-
I'm pretty sure the following would also be equivalent, some testing may be needed:
awk '/'${selected_option}'/ { $1=""; print; }' ${file}
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thank you for the suggestions! I'll make these changes tomorrow, because it's 1:38am here
Thank you again!
Last edited by betseg (2016-01-07 12:26:27)
Offline