首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows 10上的Bash filepath是错误的

Windows 10上的Bash filepath是错误的
EN

Ask Ubuntu用户
提问于 2021-02-12 08:57:13
回答 1查看 829关注 0票数 1

我正在Windows 10上安装一个开发环境,我安装了Ubuntu,我使用Hyper作为我的CLI。我的主要目标是在打开窗口( C:/Users/linds/Development )时,默认情况下让CLI指向我的开发目录。

.hyper.js设置

代码语言:javascript
复制
shell: 'C:\\Windows\\System32\\bash.exe',
shellArgs: ['~', '--login'],

Hyper中的默认shellArgs是:

代码语言:javascript
复制
shellArgs: ['--login'],

..profile

代码语言:javascript
复制
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

..bash_profile

代码语言:javascript
复制
cd ~/C:/Users/linds/Development

..bashrc

代码语言:javascript
复制
# ~/.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
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# 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

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# 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|*-256color) 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

启动我的终端时,我会收到以下消息:

代码语言:javascript
复制
bash: cd: /home/scribbles/C:/Users/linds/Development: No such file or directory
scribbles@DESKTOP-IQ51GOV:~$

我不知道/home/scribbles/从何而来,但我认为它可能与.profile有关--我不完全确定。

任何帮助都将不胜感激!

编辑:为了澄清,涂鸦是我的Ubuntu用户名。

EN

回答 1

Ask Ubuntu用户

发布于 2021-02-12 09:34:55

所以我发现bash存储文件的方式不同。要更改默认的文件路径,我不需要尝试cd ~/C:/Users/linds/Development,而是必须将.bash_profile更改为cd /mnt/c/Users/linds/Development --这样每次都会在正确的目录中打开CLI。

mkdir test测试它,它运行得很好!

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1315784

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档