/Pipex

42서울 본과정: 2서클 서브젝트

Primary LanguageC

Mandatory : 리눅스 파이프와 리다이렉션 구현하기

Bonus : 다중 파이프와 히어독 구현하기

  • Block/Non-Block, Synchronous/Asynchronous
  • Redirection, Here-doc
  • 허용함수 정리
  • 환경변수 PATH

Mandatory

$> ./pipex file1 cmd1 cmd2 file2
$> < file1 cmd1 | cmd2 > file2
$> ./pipex infile "ls -l" "wc -l" outfile
$> < infile ls -l | wc -l > outfile

$> ./pipex infile "cat" "grep hello" outfile
$> < infile cat | grep hello > outfile

$> ./pipex /dev/urandom "ls -al" "cat" outfile
$> < /dev/urandom ls -al | cat > outfile

Bonus

  • multiple pipe
$> ./pipex file1 cmd1 cmd2 cmd3 ... cmdn file2
$> < file1 cmd1 | cmd2 | cmd3 ... | cmdn > file2
$> ./pipex infile "cat" "grep hello" "wc -l" outfile
$> < infile cat | grep hello | wc -l > outfile
  • support << and >> when the first param is "here_doc"
$> ./pipex here_doc LIMITER cmd cmd1 file
$> cmd << LIMITER | cmd1 >> file
$> ./pipex here_doc limiter "cat" "grep a" outfile
$> cat << limiter | grep a >> outfile

Tester