chjj / ttystudio

A terminal-to-gif recorder minus the headaches.
Other
3.24k stars 93 forks source link

display error of bash: command not found in pseudo-terminal while start record #28

Closed zymr-keshav closed 6 years ago

zymr-keshav commented 6 years ago

in macOS x HighSierra 10.13.2

I have a custom method in ~/.bash_profile which prompt git branch name in terminal

parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# some other code
export PS1="${GREEN}\u@${YELLOW}\h:${LIGHT_RED}\w${LIGHT_GREEN}\$(parse_git_branch)${WHITE} $ 

now when I start recording with

ttystudio --outout.gif --log

it display error

parse: parse_git_branch: command not found

How to overcome this issue?

zymr-keshav commented 6 years ago

fixed problem

  1. cut the parse_git_branch() method from ~/bash_profile
  2. create new file ~/.bashrc and paste this code here.
  3. add this line in ~/.bash_profile
if [ -f ~/.bashrc ]; then 
  . ~/.bashrc; 
fi
  1. reload source ~/.bash_profile