신비한 슬램 붕괴

신비한 슬램 붕괴

다음 bash 스크립트를 실행하려고 합니다.

#!/bin/bash                                                                     
x=1
while [ $x -le 10 ]
do
    echo "Welcome $x times"
    x = $(( $x + 1))
done

이것을 실행하면 Ctrl-Z를 누를 때까지 반복되는 것처럼 보이는 일련의 메시지가 나타납니다.

im4t:test math4tots$ ./mdtest.sh
Welcome 1 times
launch_msg("CheckIn") IPC failure: Operation not permitted
Xquartz: Unable to locate waiting server: org.x.X11
Xquartz: X11.app = /Applications/Utilities/X11.app/Contents/MacOS/X11
Xquartz: Starting X server: /Applications/Utilities/X11.app/Contents/MacOS/X11 --listenonly
X11.app: main(): argc=2
    argv[0] = /Applications/Utilities/X11.app/Contents/MacOS/X11.bin
    argv[1] = --listenonly
Waiting for startup parameters via Mach IPC.
X11.app: No launchd socket handed off, unsetting DISPLAY
X11.app: do_start_x11_server(): argc=3
    argv[0] = x
    argv[1] = =
    argv[2] = 2
Unrecognized option: =
use: X [:<display>] [option]
-a #                   default pointer acceleration (factor)
-ac                    disable access control restrictions
-audit int             set audit trail level
-auth file             select authorization file
-br                    create root window with black background
+bs                    enable any backing store support
-bs                    disable any backing store support
-c                     turns off key-click
c #                    key-click volume (0-100)

...30,000자를 초과하는 긴 오류 메시지...

ttyxx                  server started from init on /dev/ttyxx
v                      video blanking for screen-saver
-v                     screen-saver without video blanking
-wm                    WhenMapped default backing-store
-wr                    create root window with white background
-maxbigreqsize         set maximal bigrequest size 
+xinerama              Enable XINERAMA extension
-xinerama              Disable XINERAMA extension
-dumbSched             Disable smart scheduling, enable old behavior
-schedInterval int     Set scheduler interval in msec
-sigstop               Enable SIGSTOP based startup
+extension name        Enable extension
-extension name        Disable extension
-query host-name       contact named host for XDMCP
-broadcast             broadcast for XDMCP
-multicast [addr [hops]] IPv6 multicast for XDMCP
-indirect host-name    contact named host for indirect XDMCP
-port port-num         UDP port number to send messages to
-from local-address    specify the local address to connect from
-once                  Terminate server after one session
-class display-class   specify display class to send in manage
-cookie xdm-auth-bits  specify the magic cookie for XDMCP
-displayID display-id  manufacturer display ID for request
[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]
                       enable/disable accessx key sequences
-ardelay               set XKB autorepeat delay
-arinterval            set XKB autorepeat interval


Device Dependent Usage:

-depth <8,15,24> : use this bit depth.
-fakebuttons : fake a three button mouse with Command and Option keys.
-nofakebuttons : don't fake a three button mouse.
-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.
-fakemouse3 <modifiers> : fake right mouse button with modifier keys.
  ex: -fakemouse2 "option,shift" = option-shift-click is middle button.
-version : show the server version.


Fatal server error:
Unrecognized option: (null)

   OsVendorFatalError
   AbortDDX
^Z
[1]+  Stopped                 ./mdtest.sh

또한 깜박이는 창이 나타납니다(반복적으로 닫혔다가 열림). 여기에 이미지 설명을 입력하세요.

그리고 관련이 있다면 Mac OS X Lion을 사용하고 있는데 별 상관은 없는 것 같습니다...

무해한 bash 스크립트처럼 보입니다 ...

답변1

이 줄에는 추가 공백이 있습니다.

x = $(( $x + 1))

쉘은 xX 서버인 것처럼 보이는 프로그램을 실행하려고 합니다(Mac OS의 표준 파일 시스템은 대소문자를 구분하지 않으므로 실제로 실행되고 있는 것 같습니다 X). 다음을 수행해야 합니다.

x=$(( $x + 1))

관련 정보