Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 645

Comment by Kamil Maciorowski on Bash function to make function for menu

$
0
0
options=( $(cd …&& find …) )– Do not go this way or some day a filename like a * b.java will surprise you. The line may kinda work after set -o noglob and with IFS=$'\n', but the right way is to cd beforehand, invoke shopt -s nullglob and finally options=( ./*.java ). And by "the right way" I mean "if you really want to populate an array with pathnames", not "this will for sure be a part of the answer here". Shells are not general-purpose programming languages; IMO "bash skills" involve acknowledging this, not fighting this.

Viewing all articles
Browse latest Browse all 645

Trending Articles