./sab-find-db
assumes thatsab-find-db
exists in your working directory. Why should it?- In the usage-output you should display the program name without path , so
die "usage: $(basename $0) ...
. - Maybe it is more useful if you use different error codes and not only '1'.
- A short comment at the beginning of the file about its purpose is useful.
sab-remove
does not contain a usage message.- Most users assume that the option '-?' produces a usage message.
- It is a good idea to use named variables in the code and not positional parameters. At the top of the function you assign the positional parameters to the named variables. If you change your parameter order or insert/delete new positional parameters you only have to change the first lines of your code.
mv
as inmv "$file" target
insab-remove
is not a good idea. "$file" replaces target, but not only the content is replaced but also the ownership and the permissions. Docp "$file" target
instead ofmv
.- I do not understand the second if-then-else statement in
sab-remove
. Does this mean you do not want to remove the last entry in the file? sab-find-db
is a name that irritates me. I would prefer something likesab-dbpath
.
jacwah
- 2.7k
- 17
- 42
jacwah
- 2.7k
- 17
- 42