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
  • 69,818
  • 15
  • 125
  • 179
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
  • 69,818
  • 15
  • 125
  • 179
KamilCuk
  • 120,984
  • 8
  • 59
  • 111
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
  • 69,818
  • 15
  • 125
  • 179