구문 오류: 알려진 새로운 작업 파일을 사용해도 .bashrc를 가져올 때 예기치 않은 파일 끝이 발생합니다.

구문 오류: 알려진 새로운 작업 파일을 사용해도 .bashrc를 가져올 때 예기치 않은 파일 끝이 발생합니다.

제목에 문제가 요약되어 있습니다. 실수로 별칭을 bashrc에 반영하고 끝으로 이동하여 가져오는 스크립트를 추가했습니다. 이로 인해 뭔가가 변경되었으므로 이제 얻으려고 하는 모든 파일(.profile도 시도했습니다)에서 이 오류가 반환됩니다. 앞으로 이런 일이 발생하지 않도록 하기 위해 무슨 일이 일어났는지 알아내려고 노력 중입니다. 알려진 작동 기본 bashrc 파일에서 텍스트를 복사했지만 여전히 동일한 작업을 수행합니다. 매우 특이한 .. 소싱을 수행하는 코드에 무언가를 주입하거나 닫히지 않은 대괄호 등을 갖도록 일부 설정이나 변수를 설정하거나 서식 설정을 지정하는 것 같은 느낌이 듭니다.

소스에서 사용되는 메커니즘을 아는 사람이 있나요? 아니면 무엇을 확인해야 할지, 어떻게 해야 하는지 알고 계시나요? 아니면 다른 방법으로 파일을 얻는 방법은 무엇입니까?

내 문제를 해결하지 못한 관련 질문: 구문 오류: 예기치 않은 파일 끝 — Bash 스크립트

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    #alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion
#fi

이 부분까지 좁혀봤습니다. 하지만 여전히 잘못된 내용이고 아래 부분은 주석 처리가 되어 있지 않습니다. : <<'END'.....END블록 주석에 goto 명령을 사용하고 있습니다 .

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

if 문이 포함된 코드 블록은 오류를 발생시킵니다. 진전! ..이 문제를 일으키는 최소한의 if 문으로 범위를 좁혔습니다.

if [ false ] ; then a=0
fi

쉘에 들어가면 if [ false ] ; then echo hi; fi닫는 따옴표나 중괄호로 끝나기를 기다리는 것처럼 > 새 줄 세트가 표시됩니다.

관련 정보