programing

.bashrc를 .zshrc로 내보내려면 어떻게 해야 하나요?

oldcodes 2023. 4. 19. 23:27
반응형

.bashrc를 .zshrc로 내보내려면 어떻게 해야 하나요?

bash에서 zsh로 이동하려고 합니다.

.bashrc를 .zshrc에 직접 복사했는데 bash를 다시 사용하려고 하면 오류가 많이 발생했습니다.

.bashrc를 .zshrc로 내보내려면 어떻게 해야 하나요?

올바른 , 는 Lhunath의 출처가 것 ..profile자동으로.이 토픽에 관한 많은 유용한 정보는 이 슈퍼 유저 투고에 있습니다.

지금 하고 있는 을 '어느 정도'에 예요..profile하다

»~/.bashrc:

source ~/.profile

»~/.zshrc:

[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'

emulate 는 zsh 기본 제공 명령어입니다.단일 인수를 사용하여 zsh 옵션을 설정하여 지정된 셸을 최대한 에뮬레이트합니다.

이 기능을 "export" 수 없습니다..bashrc a까지.zshrc.bashrc 、 is 、 that that that that that that that that that that that that를 실행하는 입니다.bash명령어를 지정합니다. .zshrc 、 is 、 that that that that that that that that that that that that를 실행하는 입니다.zsh명령어명령어를 지정합니다.

하 세 you요 can'마t?zsh to be able to run the 달릴 수 있다bashμm의 명령.bashrc, , so you should convert it into a new 새로운 것으로 변환해 주세요..zshrc instead of trying to run 도망치려 하지 않고.bashrc부에서.zshrc츠키노

의 셸 초기화 하는 경우는, 「 」를 합니다..profile 삭제(삭제)).bashrc ★★★★★★★★★★★★★★★★★」.zshrc)는, 모든 POSIX 쉘로부터 조달되고 있습니다.POSIX 쉘 기능만 사용합니다.그러면 그 코드는 어떤 POSIX 쉘에서도 실행됩니다.zshPOSIX 거 ( 。

http://mywiki.wooledge.org/DotFiles 를 참조해 주세요.

은 제가 이 에서는 틀린 안 .bash하고 때.bashrc「 」를 한zsh명령어를 입력합니다. ? 어떤 떤떤오 ?류 ?? ????내가 듣기엔 네가 더하는 것처럼 들리는데zsh .bashrc ★★★★★★★★★★★★★★★★★」bash이해 못 하겠어

로로 as asojblass는 부분적으로만 성공하는 휴대성을 강조하려고 합니다. zsh 자신도누리지 을 쓸 는 대본을 것을 대본을 쓸 때는, 다음과 같이 하는 것을 추천합니다.#!/usr/bin/env bash 최종적으로 사람입니다.대부분의 경우 휴대성을 위해 본인(그리고 최종적으로 공유하는 사람)을 위한 것입니다.

나에게 있어서, Ryen의 대답은 도움이 되었다.하지만 나는 약간의 변화를 주었다.사용자 디렉토리(vim ~/.profile)의 .profile에 있는 모든 aliases 명령을 추가했습니다.

alias gs='git status'
alias gp='git pull'
alias gph='git push'
alias gd='git diff | mate'
alias gau='git add --update'
alias gc='git commit -m'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcot='git checkout -t'
alias gcotb='git checkout --track -b'
alias glog='git log'
alias glogp='git log --pretty=format:"%h %s" --graph'
alias gfo='git fetch origin'

그런 다음 zsh 쉘뿐만 아니라 bash에도 source 명령을 추가했습니다.

bash 쉘(vim ~/.bashrc)

source ~/.profile

zsh 쉘( vim ~/.zshrc )

source ~/.profile

~/.bash_aliases에서 에일리어스를 정의하는 사용자용

에일리어스를 일원화하여 사용하는 가장 쉬운 방법은 ~/.zshrc에서 참조하는 것입니다.

gedit ~/.zshrc :

...마지막에 다음을 추가합니다.

...
# 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

완료되면 다음 작업을 수행합니다.

source ~/.zshrc

그리고...이제 bash와 zsh 사이에 에일리어스를 공유하게 되었습니다.

2개의 라인 코드를 추가합니다.~/.zshrc, zsh는 커스터마이즈된 명령어를 자동으로 실행합니다..bashrc.

# Exec ~/.bashrc and ~/.profile when using zsh
if [ -f '~/.profile' ]; then; source '~/.profile'; fi;
source <(awk '{ if(NR>118)print}' ~/.bashrc)  
# Line 118 is works for Ubuntu's default .bashrc

주의:

  • NR>118Ubuntu에서 동작하며 Ubuntu의 디폴트를 발생시킵니다..bashrc118개의 행이 있습니다.이 행들은 무시해 주세요.
  • 커스터마이즈된 명령어는 다음 명령어 끝에 추가됩니다..bashrc. 시스템의 bashrc 영역에 새 행을 삽입하지 마십시오.

언급URL : https://stackoverflow.com/questions/764600/how-can-you-export-your-bashrc-to-zshrc

반응형