0

I am trying to write a bash script, but each time I write a new script I need to change its execute permissions, e.g. chmod +x file.sh

Is it normal?

Jens
  • 65,924
  • 14
  • 115
  • 171
Abhisek
  • 11
  • 1

2 Answers2

1

Is it normal?

Yes.

Alternatively, instead of shebang line and execute permissions, you can execute interpreter explicitly like bash file.sh.

Jens
  • 65,924
  • 14
  • 115
  • 171
KamilCuk
  • 96,430
  • 6
  • 33
  • 74
0

Yes it works as designed. A new file gets permissions 0666 = rw-rw-rw, modified by the current umask (which tells which bits to remove). So with a umask of 022 new files have permissions rw-r--r--. See the manual pages for open(2) and umask(1) for details.

Jens
  • 65,924
  • 14
  • 115
  • 171