我在新安装的OSX Yosemite Machine上安装了此dotfiles-repo。安装自制软件后,我还运行了Scripts~ / .osx和brew.sh。一切都按预期工作,但不在终端。
重启后,每个终端都会出现很多错误:
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h> // for open flags
#include <time.h> // for time measurement
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
void my_exec(char* cmd, char** argv)
{
int pipefd[2], f;
if (pipe(pipefd) < 0)
perror("pipe creation failed");
f = fork();
assert(f >= 0);
if (f == 0) {
if (dup2(pipefd[1], STDOUT_FILENO) < 0)
perror("dup2 failed");
close(pipefd[0]);
} else {
if (dup2(pipefd[0], STDIN_FILENO) < 0)
perror("dup2 failed");
close(pipefd[1]);
if (execvp(cmd, argv) < 0)
perror("execvp failed");
}
}
int main(int argc, char** argv)
{
assert(strcmp(argv[argc-1], "-"));
int i;
for (i = argc-1; i >= 1; i--) {
if (!strcmp(argv[i], "-")) {
argv[i] = NULL;
my_exec(argv[i+1], &argv[i+1]);
argc = i;
}
}
if (execvp(argv[0], &argv[1]) == -1)
perror("execvp failed");
return 0;
}
此外,当我想使用bash完成时,会发生类似这样的事情:
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
-bash: complete: -D: invalid option
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
我键入“mv Dropb”然后按Tab键。其他字符“-bash:$(prev ...”然后出现并限制我在安装这些dotfiles之前使用bash完成。
我应该更改(或删除)哪些部分的dotfiles来修复这些问题?
答案 0 :(得分:1)
如本blog post所述,OSX Yosemite附带一个死旧的BASH版本(现在为3.2.57),它不支持dotfiles中使用的一些新东西。
虽然安装脚本brew.sh是上面提到的dotfiles的一部分,但安装了当前的bash-version(4.3.33),终端现在不会使用它。
以下步骤将通过brew注册的bash注册为system-wide-bash:
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
chsh -s /usr/local/bin/bash