小编Fre*_* J.的帖子

错误:.bash_profile 中的“意外的文件结尾”

当我执行时,source ~/.bash_profile我收到此错误:

line 14 syntax error: unexpected end of file
Run Code Online (Sandbox Code Playgroud)

我试图删除最后一行无济于事。

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi

PS1='\[\e[0;36m\]\W\[\e[m\]\[\e[1;31m\]\$\[\e[m\]'
if [ "$PS1" ]; then PS1="[\e[0;36m]\W\n[\e[m][\e[1;31m]\$[\e[m]" fi
function gi() { curl -L -s https://www.gitignore.io/api/$@ ;}
export LSCOLORS=cxfxcxdxbxegedabagacad
Run Code Online (Sandbox Code Playgroud)

shell bash

1
推荐指数
1
解决办法
5625
查看次数

用于 cd 到目录的 bash 脚本

在 Mac 终端上运行的这个 bash 文件无法更改目录。而是在实际存在时报告它不存在。我做错了什么吗?

#!/usr/bin/env bash
set -e
read name
APPLICATION_PATH="~/Documents/meteor/apps/$name"
cd "${APPLICATION_PATH}"
Run Code Online (Sandbox Code Playgroud)

bash cd-command shell-script

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

bash ×2

cd-command ×1

shell ×1

shell-script ×1