Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个简单的函数,fish-shell它的行为应该是这样的:
fish-shell
theFunc someArguments somecommand | theFunc
我正在寻找一种方法来了解是否使用管道/重定向调用了该函数。 你有什么想法吗?
谢谢!
如果有人需要,我正在设置信息。
正如Ben Voigt指出的那样,我们应该使用该isatty函数。 对于鱼壳,您可以简单地检查:
isatty
if isatty stdin # Your code here. end