Good vs. Evil

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
51 its the | character. Its very powerful in terminals running bash or other shells like it due to how it allows you to chain commands together.

Lets say I wanted to know if a certain file exists in a folder I could use the "ls" command to list all files and look at it for myself. However I could also write
Code:
ls | grep "some_file.txt"
and if "some_file.txt" was found it will print the line(s) that ls produced containing the filename. IF however it was not found, nothing will be printed. Also, this was just a very basic example to explain how it works.

It also has some other usages in other programming languages, it is often used for a "binary or" operator and by placing 2 of them next to each other (like || ) it often means a logical or.

A logical or written like a = b || c and means that if either b and/or c are true then a is also true. Otherwise, a is false.

For example
Code:
takes_car_instead_of_bike = it_is_raining || it_is_snowing
which just says that if it is either raining or snowing, we take the car instead of the bicycle.

the binary or (the lonely | I mentioned earlier) works pretty much the same, but then with binary number so I'm not going to explain it and just show 2 binary numbers that go through it instead. Just remember that in binary 1=true and 0 = false and you can already do any 2 numbers on your own :)
Code:
1100
1010
--------- |
1110
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
50 It's also what I used for the
"50 | 05" in the post before. Though using it in commands and programming is how I got used to it. Apparently, it's actually called the "Vertical Bar".