I created a shell script and wish to add it to bashrc. I opened /home/jub/bashrc and added the following to the end of the file:

alias myfilesync = './/home/jub/Documents/scripts/myfilesync.sh'

Then from terminal, executed:

source ~/.bashrc

Then I try to execute either




Either way, the result is "No such file or directory".

What am I doing wrong?

  • Is the space before the equals sign a copy/paste typo or in the actual bashrc file? You'll also want to name the file .bashrc – Jeff Schaller Jun 14 '16 at 22:45

Provided the script you just wrote is placed in your home directory, which I am assuming is, /home/jub, your alias directive should be

alias myfilesync='/home/jub/Documents/scripts/myfilesync.sh'

i.e., you need to drop the leading ./

  • 2
    There also cannot be any spaces around the =. – Peschke Jun 14 '16 at 22:52
  • 1
    It also might be worth while to explain why they need to drop the ./ – Peschke Jun 14 '16 at 22:52
  • Thanks, dropped the `.` and the spaces around the = sign, and it worked. How do I mark the question as answered? – jub Jun 14 '16 at 23:16

Just other answer

Open and edit your .bashrc

alias myfilesync='/home/jub/Documents/scripts/myfilesync.sh'

Please note there are no spaces between =

Please note there's no leading ./, while you are specifying the path of the script, it is not needed

Check the script has the execute permission

Close your current terminal session and try again. If you want to skip this step, just set up the alias in your current prompt

$ alias myfilesync='/home/jub/Documents/scripts/myfilesync.sh'

Not the answer you're looking for? Browse other questions tagged or ask your own question.