Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with tput #40

Open
sprankhub opened this issue Mar 23, 2013 · 4 comments
Open

Problem with tput #40

sprankhub opened this issue Mar 23, 2013 · 4 comments

Comments

@sprankhub
Copy link
Contributor

On a client's server, I get the following output when using modman:
./module-manager/modman: Zeile 223: tput: Kommando nicht gefunden.
./module-manager/modman: Zeile 224: tput: Kommando nicht gefunden.

Maybe it is possible to avoid the usage of tput or check if it is available beforehand...

@kojiromike
Copy link

tput is a IEEE Std 1003.1-2001 standard utility. It might not hurt to check if it's available before using it, but it would be pretty fair to not support such a nonstandard system, too.

@pocallaghan
Copy link
Contributor

Since tput is only used for output formatting and is never called if stdout isn't connected to a terminal, it doesn't seem like too much of a problem to support a system without it. One potential way would be to change ISTTY=0; if [ -t 1 ]; then ISTTY=1; fi to something like ISTTY=0; if [ -t 1 ] && type "tput" > /dev/null; then ISTTY=1; fi. Technically this may make the name of the ISTTY variable semantically inaccurate, but I think it would work.

NB: I'm assuming that type will be available in systems where tput is not, this is purely an assumption by somebody with minimal bash experience.

@colinmollenhour
Copy link
Owner

On my test system "type type" says it is a shell built-in so since Bash is already a requirement then I would think "type tput" should be safe.

@kojiromike
Copy link

type is a POSIX utility. Any of type, hash, and command utilities provide POSIX-compliant means to determine if an external command exists. My preference would be a custom shell function to wrap and clarify intent, e.g.

installed() {
    type "$1" >/dev/null 2>&1
}

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants