DEV Community

Discussion on: Read me first

Collapse
 
vlasales profile image
Vlastimil Pospichal • Edited

I don't like side effects

configure_find_command() {
  if command -v rg >/dev/null; then
    echo "rg --files --iglob readme --iglob readme.md --iglob readme.txt"
    return
  fi
  echo "find . -type f -iname readme -o -iname readme.md -o -iname readme.txt"
}

find_command="$(configure_find_command)"
Collapse
 
moopet profile image
Ben Sinclair • Edited

Do you mean you don't want it to do the fuzzy selection or launch an editor? If so, it's not particularly worth it as a script, is it?

EDIT: oh wait, I misread. You mean you don't like me futzing with global variables. That's valid.

Collapse
 
vlasales profile image
Vlastimil Pospichal

Yes, I mean global variables.

Collapse
 
moopet profile image
Ben Sinclair

Though exit will bomb out of the script, and should be return. I might re-work this script later.