By using AWS re:Post, you agree to the Terms of Use
/No such file or directory /.bashrc/

No such file or directory /.bashrc


Good afternoon dear experts. Help solve the issue. I run the sh file (with rights) through the terminal, I get No such file or directory /.bashrc Google didn't help. I'm beating this wall for the 3rd evening).

sh file content:

         source ~/.bashrc
         cd ~/data

Contents of the .bashrc file:

    "# .bashrc"
      export PATH="~/.pyenv/bin:$PATH"
     eval "$(pyenv init -)"
      eval "$(pyenv virtualenv-init -)"
      # Source global definitions
     if [ -f /etc/bashrc ]; then
   . /etc/bashrc
    "# Uncomment the following line if you don't like systemctl's auto-paging feature:"
    "# export SYSTEMD_PAGER="
    "# User specific aliases and functi"
    "# >>> conda initialize >>>"
   "# !! Contents within this block are managed by 'conda init' !!"
     __conda_setup="$('/home/ec2-user/.pyenv/versions/anaconda3-2020.11/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
       if [ $? -eq 0 ]; then 
       eval "$__conda_setup"
      if [ -f "/home/ec2-user/.pyenv/versions/anaconda3-2020.11/etc/profile.d/" ]; then
      . "/home/ec2-user/.pyenv/versions/anaconda3-2020.11/etc/profile.d/"
      export PATH="/home/ec2-user/.pyenv/versions/anaconda3-2020.11/bin:$PATH"
     unset __conda_setup
     "# <<< conda initialize <<<"
1 Answers

Assuming you get that error message when you run the first command (source ~/.bashrc) it's saying there isn't a .bashrc file in your home directory - which will be /home/username/ so check there to make sure the file exists.

answered 2 months ago
  • Here is the command sequence cd /home/ec2-user ls -a finds the .bashrc file vi .bashrc opens it but when i run the file source /home/ec2-user/.bashrc or source ~/.bashrc cd ~/data python I get: No such file or directory: line 1: /home/ec2-user/.bashrc

  • i do sh data/

    First line in file: source ~/.bashrc I tried changing the path, changing the file name, creating a directory, copying the file to a new directory. The result is the same: No such file or directory: line 1: /home/ec2-user/.bashrc

  • If I enter: bash data/ (second line in the file: cd ~/data) I get an error: No such file or directoryhome/ec2-user/data

  • Or do I just need to run a python script on a schedule :-)

  • Guessing: Check the owner/permissions on just in case there is something strange there. Also: Check for special characters in - try creating it again in vi or something that is a plain-text editor.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions