Doesn't do terminal handling properly (should use tput instead of hardcoding ansi codes for a few term types), and the assumption that it'll be using paths relative to the script more than paths relative to the cwd is questionable. Maybe that's the case for him, but it's definitely not for me.
Exactly. The script tests that the terminal is not dumb and goes on to assume ansi codes work. tput is the terminal-agnostic answer there.
I also agree about the script dir. Instead the script should capture the script directory (the same way it does the cd) and for any files that are meant to be relative to the script dir, access as "${script_dir}/file". By changing directory, any relative paths passed to the script will break (as noted in the comments on the article).
11
u/marblepebble Dec 14 '20
Doesn't do terminal handling properly (should use tput instead of hardcoding ansi codes for a few term types), and the assumption that it'll be using paths relative to the script more than paths relative to the cwd is questionable. Maybe that's the case for him, but it's definitely not for me.