Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- - eg1.1
- fish code:
- begin
- if isatty 1
- echo "yes isatty 1"
- else
- echo "no isatty 1"
- end
- end
- result:
- writes to terminal:
- yes isatty 1
- - eg1.2
- fish code:
- begin
- if isatty 1
- echo "yes isatty 1"
- else
- echo "no isatty 1"
- end
- end > tempfile.txt
- result:
- writes to file:
- no isatty 1
- --
- - eg2.1
- fish code:
- begin
- echo "line 1"
- echo "line 2"
- echo "line 3"
- end > tempfile.txt
- result:
- the file contains:
- line 1
- line 2
- line 3
- - eg2.2
- fish code:
- begin
- echo "line 1"
- echo "line 2" > /dev/stdout
- echo "line 3"
- end > tempfile.txt
- result:
- to the terminal gets written:
- line 2
- and the file contains:
- line 1
- line 3
- --
- - eg3.1
- fish code:
- begin
- ls
- end > tempfile.txt
- result:
- this was run in a dir containing two files:
- f1
- f2
- the file tempfile.txt ended up containing:
- f1
- f2
- tempfile.txt
- - eg3.2
- fish code:
- begin
- ls > /dev/stdout
- end > tempfile.txt
- result:
- again, run in a dir containing two files:
- f1
- f2
- it wrote to the terminal:
- f1 f2 tempfile.txt
- and the file tempfile.txt ended up being empty
- --
- - eg4.1
- fish code:
- if isatty 0
- echo yup
- else
- echo no
- end
- result:
- writes to terminal:
- yup
- - eg4.2
- fish code:
- if isatty 0
- echo yup
- else
- echo no
- end < tempfile.txt
- result:
- writes to terminal:
- no
Advertisement
Add Comment
Please, Sign In to add comment