./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 a named variable in the code and not a positional parameter. 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
instaed ofmv
.- I do not understand the second if-then-else statement in add-remove. Does this mean you do not want to remove the last ntry in the file?
sab-find-db
is a name that irritates me. I would prefer something likesab-dbpath
.
miracle173
- 1.3k
- 6
- 19