Linux Bash Shell Script Error: cannot execute: required file not found
33
votes
6
answers
170050
views
I have two similar scripts with different names. One works fine but other throws error.
Can anyone please tell me what is the issue?
This is my test.sh scripts which works fine
[nnice@myhost Scripts]$ cat test.sh
#!/bin/bash
function fun {
echo "hostname
"
}
fun
[nnice@myhost Scripts]$ ./test.sh
myhost.fedora
Here is my another script demo.sh but it throws error
[nnice@myhost Scripts]$ cat demo.sh
#!/bin/bash
function fun {
echo "hostname
"
}
fun
[nnice@myhost Scripts]$ ./demo.sh
bash: ./demo.sh: cannot execute: required file not found
Both scripts having the same permissions
[nnice@myhost Scripts]$ ll test.sh
-rwxr-xr-x. 1 nnice nnice 65 Oct 21 10:47 test.sh
[nnice@myhost Scripts]$ ll demo.sh
-rwxr-xr-x. 1 nnice nnice 58 Oct 21 10:46 demo.sh
Asked by Nitin Kumar
(465 rep)
Oct 21, 2022, 05:41 AM
Last activity: Jul 18, 2025, 03:01 PM
Last activity: Jul 18, 2025, 03:01 PM