본문 바로가기

Linux

[Linux/Shell] OSError: [Errno 7] Argument list too long: 'bash' 오류 해결 방법 bash shell을 호출하면서 매우 긴 argument를 넣는 경우 이러한 에러를 볼 수 있다. 필자는 echo 로 엄청나게 긴 json 스트링을 파일에 리다이렉션 하는 경우 발생했다. 예를 들면 다음과 같다. 오류예시 코드: echo ${verrrrrry long string} > tmp.json >> OSError: [Errno 7] Argument list too long: 'bash' 이 외에도 디렉토리의 하위에 파일이 매우 많은경우 ls 를 수행했을 때도 발생할 수 있다. 이러한 경우 사용하는 argument 사이즈를 줄이거나, stack 사이즈를 늘려서 더 많은 argument를 받을 수 있게 해야한다. stack 사이즈 조절(최대치 허용): ulimit -s unlimited 추가로 she.. 더보기
[Linux/Shell] 리눅스 쉘에서 인자(Argument)의 limit을 확인하는 방법 shell에서 argument를 사용할 때 특정 길이를 넘지 않도록 해야한다. 아마 일반적인 경우에는 그런일이 별로 없겠지만 가끔 인자가 특정 길이를 넘기면 오류가 발생하는 것을 확일할 수 있다. OSError: [Errno 7] Argument list too long: 'bash' 그렇다면 어떻게 하면 인자의 limit을 확인할 수 있을까? 방법은 다음과 같다. 인자 최대길이(바이트)를 출력하는 command: getconf ARG_MAX 결과: 더보기
[linux/centos7] mail postfix system 상태 확인 및 실행 CENTOS 7 환경 Postfix mail system 동작 확인 후 실행 sudo postfix status postfix/postfix-script: the Postfix mail system is not running sudo postfix start postfix/postfix-script: starting the Postfix mail system 더보기
[linux] What is '$?' in bash shell Unlike functions in “real” programming languages, Bash functions don’t allow you to return a value when called. When a bash function completes, its return value is the status of the last statement executed in the function, 0 for success and non-zero decimal number in the 1 - 255 range for failure. The return status can be specified by using the return keyword, and it is assigned to the variable .. 더보기
[Linux] grep을 활용한 특수문자 추출 how to grep lines contains special chracter. how to grep not english, korean, digit chracter. CENTOS 7 기준 옵션 -P, --perl-regexp PATTERN is a Perl regular expression command grep -P "[^a-zA-Z0-9\d\s가-힣]" 해석하자면 다음과 같다 a-z 또는 A-Z 또는 0-9 또는 \d(digit number) 또는 \s(space) 또는 가-힣 에 포함되지 않는(^) 문자가 포함된 라인을 출력한다. 더보기