0

I am executing the program below in Ubuntu and getting an error - bash: ./helloworld.sh: No such file or directory

#!/bin/bash
echo "Hello World"

I checked bash and also gave chmod permissions

1
  • 6
    You're trying to run the script in the wrong directory or the filename is different. You'd get a different error message if it was a permission issue.
    – Freddy
    Dec 30, 2020 at 3:18

1 Answer 1

2

There are three things I would check:

  • Confirm /bin/bash exists and is executable
  • Confirm ./helloworld.sh exists
  • Confirm ./helloworld.sh is executable
4
  • Hi Shane, you mean to check them by using ls -lrt or anyother way Dec 30, 2020 at 5:48
  • @VijayShankar You could use ls -l ./helloworld.sh and ls -l /bin/bash to verify that those two files exist.
    – Kusalananda
    Dec 30, 2020 at 9:38
  • @kusalnanda, please find below scrennshot and guide Dec 30, 2020 at 10:48
  • @VijayShankar If you wish to update your question with further information, then do so by editing the question.
    – Kusalananda
    Dec 30, 2020 at 12:04

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