* shell script can't tell if in compile window @ 2003-06-17 8:11 Dan Jacobson [not found] ` <m3he6o8hap.fsf@multivac.cwru.edu> 0 siblings, 1 reply; 7+ messages in thread From: Dan Jacobson @ 2003-06-17 8:11 UTC (permalink / raw) Cc: robert_hundt Gentlemen, in the shell originally we could check with test -t or case $- in *i* or $TERM to tell if we are in an interactive session. Now compile mode has messed this all up so there is no way to test anymore. All tests act like we are just as interactive as if we were at a shell window. By the way, the painful "check the process tree" method http://groups.google.com/groups?selm=jyqHa.2671%243Q7.719%40news.cpqcorp.net still wouldn't enable a shell script to tell the difference between an {emacs compile window} vs. {emacs shell window, non-emacs shell window} I bet. Hmmm, how about you powder users, does (shell-command "echo $TERM") and (compile "echo $TERM") get real live term names like me (on debian, no .profile stuff)? Aren't these usually exported when emacs encounters them? Should TERM be removed from compile mode's environment? Why does (shell-command "test -t&&tty") get so far to tell me 'not a tty'!? Wait, (shell-command "/usr/bin/test -t&&tty") doesn't get that far, good. Aren't they supposed to act the same? Ok, do I send a coreutils bug or a bash bug?? Must be a bash bug because how could test -t && tty ever pass the first hurdle. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <m3he6o8hap.fsf@multivac.cwru.edu>]
* test -t FD vs. [FD] [not found] ` <m3he6o8hap.fsf@multivac.cwru.edu> @ 2003-06-18 20:47 ` Dan Jacobson 2003-06-21 4:07 ` Paul Eggert 2003-06-18 21:01 ` shell script can't tell if in compile window Dan Jacobson 1 sibling, 1 reply; 7+ messages in thread From: Dan Jacobson @ 2003-06-18 20:47 UTC (permalink / raw) [remove emacs group when following up] >> Why does (shell-command "test -t&&tty") get so far to tell me 'not a >> tty'!? Paul> With a single argument, test only tells you whether that arguments is Paul> empty. You want "test -t 0" (or 1 or 2). $ man test -t [FD] file descriptor FD (stdout by default) is opened on a terminal I.e. argument optional $ help test -t FD True if FD is opened on a terminal. Not so optional with bash then. You guys should unify them. >> Wait, (shell-command "/usr/bin/test -t&&tty") doesn't get that >> far, good. Paul> Looks like /usr/bin/test is buggy. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: test -t FD vs. [FD] 2003-06-18 20:47 ` test -t FD vs. [FD] Dan Jacobson @ 2003-06-21 4:07 ` Paul Eggert 2003-06-23 16:27 ` Paul Jarc 0 siblings, 1 reply; 7+ messages in thread From: Paul Eggert @ 2003-06-21 4:07 UTC (permalink / raw) Cc: bug-bash Dan Jacobson <jidanni@jidanni.org> writes: > $ man test > -t [FD] > file descriptor FD (stdout by default) is opened on a terminal > I.e. argument optional > > $ help test > -t FD True if FD is opened on a terminal. > Not so optional with bash then. > > You guys should unify them. POSIX long ago decided that FD is not optional with test -t. GNU 'test' conforms to POSIX in this respect. This means GNU 'test' is incompatible with ancient Unix 'test', but that's life in the big city. The original specification had an ambiguous grammar, and POSIX removed the ambiguity by making FD required. Reference: http://www.opengroup.org/onlinepubs/007904975/utilities/test.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: test -t FD vs. [FD] 2003-06-21 4:07 ` Paul Eggert @ 2003-06-23 16:27 ` Paul Jarc 0 siblings, 0 replies; 7+ messages in thread From: Paul Jarc @ 2003-06-23 16:27 UTC (permalink / raw) Cc: Dan Jacobson Paul Eggert <eggert@CS.UCLA.EDU> wrote: > POSIX long ago decided that FD is not optional with test -t. GNU > 'test' conforms to POSIX in this respect. bash's does, but coreutils' doesn't. $ /bin/test -t > /dev/null ; echo $? 1 $ /bin/test --version test (GNU coreutils) 5.0 Written by FIXME: ksb and mjb. Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. paul ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell script can't tell if in compile window [not found] ` <m3he6o8hap.fsf@multivac.cwru.edu> 2003-06-18 20:47 ` test -t FD vs. [FD] Dan Jacobson @ 2003-06-18 21:01 ` Dan Jacobson 2003-06-18 22:22 ` Paul Jarc 1 sibling, 1 reply; 7+ messages in thread From: Dan Jacobson @ 2003-06-18 21:01 UTC (permalink / raw) Cc: bug-bash >>>>> "Paul" == Paul Jarc <prj@po.cwru.edu> writes: Paul> Dan Jacobson <jidanni@jidanni.org> wrote: >> case $- in *i* Paul> Works for me. Not in a script: case $- in *i*)read -p Age: age;esac OK, one must do ". ./script" >> (shell-command "echo $TERM") Paul> I get "dumb", which seems right. but that's the same for both *shell* and *compile* I want to write a script that can do read -p Age: age only if the user can answer it. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell script can't tell if in compile window 2003-06-18 21:01 ` shell script can't tell if in compile window Dan Jacobson @ 2003-06-18 22:22 ` Paul Jarc 2003-06-19 0:43 ` Dan Jacobson 0 siblings, 1 reply; 7+ messages in thread From: Paul Jarc @ 2003-06-18 22:22 UTC (permalink / raw) Cc: robert_hundt Dan Jacobson <jidanni@jidanni.org> wrote: > I want to write a script that can do > read -p Age: age > only if the user can answer it. As I said, you want "test -t 0". paul ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell script can't tell if in compile window 2003-06-18 22:22 ` Paul Jarc @ 2003-06-19 0:43 ` Dan Jacobson 0 siblings, 0 replies; 7+ messages in thread From: Dan Jacobson @ 2003-06-19 0:43 UTC (permalink / raw) Cc: bug-gnu-emacs >>>>> "P" == Paul Jarc <prj@po.cwru.edu> writes: P> Dan Jacobson <jidanni@jidanni.org> wrote: >> I want to write a script that can do >> read -p Age: age >> only if the user can answer it. P> As I said, you want "test -t 0". $ emacs -q -eval '(compile "test -t 0&&read -p age: age||echo cant answer here so dont ask")' You are giving me the wrong test then. It is still asking. I need a test that can tell a compile window from windows that can interact. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-06-23 16:27 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-06-17 8:11 shell script can't tell if in compile window Dan Jacobson [not found] ` <m3he6o8hap.fsf@multivac.cwru.edu> 2003-06-18 20:47 ` test -t FD vs. [FD] Dan Jacobson 2003-06-21 4:07 ` Paul Eggert 2003-06-23 16:27 ` Paul Jarc 2003-06-18 21:01 ` shell script can't tell if in compile window Dan Jacobson 2003-06-18 22:22 ` Paul Jarc 2003-06-19 0:43 ` Dan Jacobson
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).