我正在Windows 10上安装一个开发环境,我安装了Ubuntu,我使用Hyper作为我的CLI。我的主要目标是在打开窗口( C:/Users/linds/Development )时,默认情况下让CLI指向我的开发目录。
.hyper.js设置
shell: 'C:\\Windows\\System32\\bash.exe',
shellArgs: ['~', '--login'],Hyper中的默认shellArgs是:
shellArgs: ['--login'],..profile
# ~/.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
cd ~/C:/Users/linds/Development..bashrc
# ~/.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启动我的终端时,我会收到以下消息:
bash: cd: /home/scribbles/C:/Users/linds/Development: No such file or directory
scribbles@DESKTOP-IQ51GOV:~$我不知道/home/scribbles/从何而来,但我认为它可能与.profile有关--我不完全确定。
任何帮助都将不胜感激!
编辑:为了澄清,涂鸦是我的Ubuntu用户名。
发布于 2021-02-12 09:34:55
所以我发现bash存储文件的方式不同。要更改默认的文件路径,我不需要尝试cd ~/C:/Users/linds/Development,而是必须将.bash_profile更改为cd /mnt/c/Users/linds/Development --这样每次都会在正确的目录中打开CLI。
用mkdir test测试它,它运行得很好!
https://askubuntu.com/questions/1315784
复制相似问题