Hi,
I'm porting a script from bash to fish which reads stdin and I have a
problem with determining if there is anything to read from stdin or (n
the other case) input should be fetched from call params.
There is in the original script:
# If no tty, data should be available on stdin
if ! [[ "$( tty )" == /dev/* ]]; then
input="$(< /dev/stdin)"
# Else, fetch input from params
else
input="$*"
fi
and in fact when used after pipe it returns "not a tty". In fish it
works fine for a simple execution:
$ echo "aaa" | tty
not a tty
but when tty is called within my function it always returns /dev/pts/*.
How can I determine that my function has something to on read stdin (to
not call "read" then which would open an interactive prompt)?
Marcin
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users