Skip to content

Latest commit

 

History

History
36 lines (31 loc) · 984 Bytes

_2_Tips.md

File metadata and controls

36 lines (31 loc) · 984 Bytes

Linux I/O Redirection STREAMS:

Save stream ( in this case the echo output) in a file (or create a new file and save output if file is nonexisting):

echo "Hellow world" > file.txt

Append to a file:

echo "Hellow world" >> file.txt

Send contect of a file to a program

read.py < file.txt

PIPLINES: connects the output of a command to another command

cat file.txt | cut -d " " -f1

Variables and globs

Variables are stored without space
Wrong: variable = "Hi there"
Correct: variable="Hi there"
To call variable use '$'
echo $varaible
OUTPUT: Hi there

GLobs are similar to wild cards

  • echo *.py (prints all the .py files in current directory)
  • echo c*.py (prints all the .py files that start with c in current directory)
  • echo ????.py (prints all .py with 4 letters in current directory)