Linux modify environment variables, redirection

1.Linux under changes (current user) environment variable: After entering vim ~ / .profile entered in the terminal, add the last line PATH = "-----------------: $ PATH ", enter the file name directly after adding -> enter

Add environment variables to all users: / etc / profile, add the last line PATH = "-----------------: $ PATH", enter the file name directly after the addition of - > Enter

2. Check the environment variable: env

3.export PATH="--------------:$PATH"

export AA="star"

 echo  $star

(The above command will be executed) echo

4.echo wrap

echo -n does not wrap == printf (default not wrap)

5 pipe character: cat -n qq.py | qq.py -rn | wc -l

        Output: 3

6. Redirection:>

(1)> ww.txt

cat ww.txt file was empty

(2)> qw.txt empty if file exists, if the file does not exist, create

(3) additional content, echo to qw.txt inside "to child star, refuel" >> qw.txt

echo itself has a wrap

Right 7. Standard Output: 1>

(1) to write files to qw.txt qq.py in ------> cat qq.py 1> qw.txt

(2) the file is added to qw.txt qq.py in ------> cat qq.py 1 >> qw.txt

8. The standard error output: 2>

(1)cat asdf 2> qw

Because there is no qw this file, so the error message qw, cat qw qw see an error message will be displayed

9. The right standard error output ------> cat asdf &> qw

cat qq.py 1> qw 2> ww

cat qq.py 1 >> qw 2 >> ww two documents will be displayed

>: File overwrites

>>: Append files

Guess you like

Origin www.cnblogs.com/startl/p/11853890.html