Score:0

Cannot run bash script

cn flag

I tried to make a bash script to open a file in VS code but it is giving the error:

Bash: ./open.sh: Permission denied

This is the script:

#!/usr/bin/bash
code  $1
Matthias Lenmher avatar
nl flag
Have you tried to set correct permissions to bash script?
Artur Meinild avatar
vn flag
And by correct permissions you mean setting it as executable: `chmod +x ./open.sh`
David avatar
cn flag
Since there is no Ubuntu version mentioned what does this have to do with Ubuntu?
Score:0
in flag

In the terminal, you can type chmod +x ./open.sh.

In Nautilus (or whatever file manager you use), you can find a Permissions tab, then the checkbox that says Allow executing file as program, and clicking it so it shows the check-mark.

Manav Ghai avatar
cn flag
I did that I can show you the "ls -l" result. Do you what to see it?
Achak Claw avatar
in flag
Sure, go ahead.
Manav Ghai avatar
cn flag
total 0 -rw-rw-r-- 1 manav manav 0 Mar 2 14:04 open.sh the output of ls -l
Achak Claw avatar
in flag
Have you tried changing the permissions in Nautilus through the root account?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.