From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Setting the script interpreter and permissions - Linux Tutorial
From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
Setting the script interpreter and permissions
- [Instructor] Let's jump in to Bash shell scripts, also known as shell programs. So first of all, the first two characters in the file often should be hash or pound sign, exclamation point, and that little combination of two characters is sometimes called the shebang. And after the shebang should be the path to the program to interpret the file. And since it's a Bash script, it's usually the path to the Bash program, which typically is bin/bash, /bin/bash. And if for example, you change your path and Bash is some weird place or something, if you want to have the shell find the Bash path that you want it to use, then you could usr/bin/env and bash and then that would find the path to Bash. But that's very unusual for Bash, so bin/bash is typical. If you don't say that then you might not know what shell is going to interpret the program, so that's not a good idea. Use the #!/bin/bash. So what happens when you run a program, a shell script or a compiled C program is the kernel has to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Exploring the Bash documentation2m 27s
-
(Locked)
Setting the script interpreter and permissions5m 49s
-
(Locked)
Date and time commands5m 36s
-
(Locked)
Shell variables4m 28s
-
(Locked)
Bash startup2m 52s
-
(Locked)
Sourcing and aliasing with Bash3m 31s
-
(Locked)
Displaying text with the echo command4m 12s
-
(Locked)
Challenge: Exported variables, sourcing, and echo2m 17s
-
(Locked)
Solution: Exported variables, sourcing, and echo4m 7s
-
-
-
-
-