We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 192a672 commit 69f3799Copy full SHA for 69f3799
chatgpt.sh
@@ -216,15 +216,16 @@ fi
216
217
running=true
218
# check input source
219
-# if prompt already entered, run on pipe mode (run once, no chat)
220
-# prompt from pipe
221
-if [ -p /dev/stdin ]; then
222
- pipe_mode_prompt+=$(cat -)
223
# prompt from argument
224
-elif [ -n "$prompt" ]; then
+if [ -n "$prompt" ]; then
225
pipe_mode_prompt=${prompt}
226
-else
+# if input file_descriptor is a terminal
+elif [ -t 0 ]; then
227
echo -e "Welcome to chatgpt. You can quit with '\033[36mexit\033[0m'."
+# if prompt already entered, run on pipe mode (run once, no chat)
+# prompt from pipe
+else
228
+ pipe_mode_prompt+=$(cat -)
229
fi
230
231
while $running; do
0 commit comments