2016-07-18 2 views
0

ksh가 구문을 처리하는 방법을 알아 내려고 시도했습니다! (텍스트). 예를 들어,Korn 셸 메타 문자 :! (일부 텍스트)는 무엇을 의미합니까?

$은 (안녕하세요) (이 오히려 행보다 열로 분류되어있어 제외하고 ls 명령의 출력과 유사)

현재 디렉토리에있는 파일의 목록을 생성합니다! 에코. 어떤 텍스트가 괄호 안에 있는지는 중요하지 않으며 출력도 같습니다.

명령이 실제로 무엇을하고 있는지 나에게 밝혀 줄 수 있습니까? 감사!

답변

0

hello를 제외한 모든 파일을 에코합니다. 다음과 같은 와일드 카드를 사용할 수도 있습니다. echo !(*.java)

0

다음은 좀 더 자세한 정보입니다. 자세한 정보는 ksh 맨 페이지의 "파일 이름 생성"섹션을보십시오 (bash는 같은 방식으로 작동합니다). 더 많은 패턴, 여기를 참조 : 그래서 예를 들면 https://www.mkssoftware.com/docs/man1/sh.1.asp

A sub-pattern begins with a ?, *, +, @, or ! character followed by a pattern-list 
enclosed in parentheses. Pattern-lists themselves can contain sub-patterns. 
The following list describes valid sub-patterns. 

?(pattern-list) 
     Matches exactly zero or exactly one occurrence of the specified pattern-list. 

*(pattern-list) 
     Matches zero or more occurrences of the specified pattern-list. 

+(pattern-list) 
     Matches one or more occurrences of the specified pattern-list. 

@(pattern-list) 
     Matches exactly one occurrence of the specified pattern-list. 

!(pattern-list) 
     Matches any string that does not match the specified pattern-list. 

을, 쉘은 파일 이름과 일치하는 모드로 전환 괄호 다음에 인용되지 않은 느낌표를 볼 때, 그것은 그렇지 현재 디렉토리에있는 파일을 표시합니다 "hello"와 일치합니다.

관련 문제