cdrun.sh

   cdrun.sh

  사용법


	cdrun.sh [-e][-p] "command_line" directory [directory ...]

	Options are as follows:

	-e             ignore error
	-p             print changed directory
	command_line   command_line to run by /bin/sh
	directory      directory where the command_line is run
  설명

cdrun.sh 명령어는 지정한 디렉토리에 각각 들어가서 지정한 명령어(command line)를 실행한다.

# ls -F
data.20070217.000000.60/  data.20070218.000000.60/  data.20070219.000000.60/
# cdrun.sh -p 'mkrep.sh stat' data.*
PWD: /USER/data.20070217.000000.60
Top web page is index_stat.html

PWD: /USER/data.20070218.000000.60
Top web page is index_stat.html

PWD: /USER/data.20070219.000000.60
Top web page is index_stat.html

-p 옵션을 지정하면 지정한 디렉토리에 들어간 후에 절대 경로를 화면에 출력한다.

cdrun.sh 명령어가 지정한 디렉토리에 들어갈 수 없을 경우에 오류 메세지를 출력하고 작업을 중단한다. -e 옵션을 지정하면, 지정한 디렉토리에 들어갈 수 없을 경우에도 중단되지 않고 나머지 디렉토리에 대하여 처리를 계속한다.

세개의 시스템(cat, lion, tiger)에서 mdbx 파일을 가져와서 각각의 시스템 명의 디렉토리를 만들고 그 파일을 복사한다.
다음은 cdrun.sh 명령어를 사용하여 각 시스템에 대한 9월 18일 날짜의 CPU 사용률 그래프를 만드는 예제이다.

# ls -F
cat/    lion/   tiger/
# ls *
cat:
mdbx-2007.09

lion:
mdbx-2007.09

tiger:
mdbx-2007.09

# cdrun.sh "mrepx -o cpu -b . D:2007.09,18,0,24,1,100,1,3,CPU" * 

# ls *
cat:
cpu.gif    mdbx-2007.09

lion:
cpu.gif    mdbx-2007.09

tiger:
cpu.gif    mdbx-2007.09