왕초보 쉘스크립트입니다;; 문제좀 봐주세요

vlzkcbcb의 이미지

요지는 메모리 FULL 을 방지하기위해 90% 가 넘어갈경우

일부 디버그파일을 삭제하는 명령어를 담은 파일(/usr/sbin/killdebug)을 실행합니다.

각각 COUNT 마다 잘넘어가는지 확인하기위해 echo helloXX 를 넣어놨는데요;;

실행하면 helloXX 는 보이지 않고

line 55: syntax error: unexpected end of file

위 메세지만 나옵니다 ㅠ_ㅠ 그 문제의 스크립트는 아래와 같습니다.

문제점좀 찾아주세요 ㅠ_ㅠ

#!/bin/sh
COUNT90=` df | grep 90% | wc -l | xargs echo`
if [ $COUNT90 -eq 0 ] ;
then
echo hello90

COUNT91=` df | grep 91% | wc -l | xargs echo`
if [ $COUNT91 -eq 0 ] ;
then
echo hello91

COUNT92=` df | grep 92% | wc -l | xargs echo`
if [ $COUNT92 -eq 0 ] ;
then
echo hello92

COUNT93=` df | grep 93% | wc -l | xargs echo`
if [ $COUNT93 -eq 0 ] ;
then
echo hello93

COUNT94=` df | grep 94% | wc -l | xargs echo`
if [ $COUNT94 -eq 0 ] ;
then
echo hello94

COUNT95=` df | grep 95% | wc -l | xargs echo`
if [ $COUNT95 -eq 0 ] ;
then
echo hello95

COUNT96=` df | grep 96% | wc -l | xargs echo`
if [ $COUNT96 -eq 0 ] ;
then
echo hello96

COUNT97=` df | grep 97% | wc -l | xargs echo`
if [ $COUNT97 -eq 0 ] ;
then
echo hello97

COUNT98=` df | grep 98% | wc -l | xargs echo`
if [ $COUNT98 -eq 0 ] ;
then
echo hello98

COUNT99=` df | grep 99% | wc -l | xargs echo`
if [ $COUNT99 -eq 0 ] ;
then
echo hello99

COUNT100=` df | grep 100% | wc -l | xargs echo`
if [ $COUNT100 -eq 0 ] ;
then
echo hello100

else

/usr/sbin/killdebug

fi
exit 0
fi

ktd2004의 이미지

혹시 windows에서 파일을 작성해서 linux로 옮기셨나요?

다음과 같이 한후에 다시 실행해 보시죠..

$ dos2unix aaaa.sh
nonots의 이미지

if 문이 이상하긴하네요..
하나의 if 문은 하나의 fi 로 닫아야 하는데
시작한 if 는 많은데 닫는 fi 는 ...??

if
elif
else
fi
와 같이....
..
차라리 case 문을 쓰시든지..

=== 건달의 경지를 꿈꾸며 ===


=== 건달의 경지를 꿈꾸며 ===

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.