OS/Linux
[Linux] && , || , ;
bbuljj
2016. 10. 16. 14:03
1. && : 앞의 명령이 성공해야만 뒤의 명령을 수행
ex) aaaa && top
result) -bash: net: command not found
2. || : 앞의 명령이 실패하면 뒤의 명령을 수행
ex) aaaa || top
result) Processes: 260 total, 2 running, 8 stuck, 250 sleeping, 1353 threads ....
3. ; : 성공 실패와 상관없이 수행
ex) a ; b ; c
-bash: a: command not found
-bash: b: command not found
-bash: c: command not found
4. >> : 해당명령을 append
ex)
$ ls >> t.txt
result)
events-snb/
nginx.plist~
nohup.out
setting/
snb/
t.txt
test/
testLog/
total 184
drxxr-xr-x+ 50 root staff 1700 10 16 13:58 ./
drxxr-xr-x 6 root staff 204 9 12 02:11 ../
-r-------- 1 root staff 8 9 11 18:27 .CFUserTextEncoding
drxxr-xr-x+ 3 root staff 102 9 12 05:38 .CrossWeb/
5. > : 해당 명령을 overwrite
ex)
$ ls > t.txt
result)
$ cat.txt
events-snb/
nginx.plist~
nohup.out
setting/
snb/
t.txt
test/
testLog/