Linux Tip of the Day (Beginner Bash Scripting): ๐Ÿ’ป๐Ÿ—’๏ธ
Always start your script with #!/bin/bash.
That first line is called a shebang (#!). It tells Linux which program should run the script. Without it, your script might not run correctly.
Example:
#!/bin/bash
echo "Hello, world!"
Steps to run it:
Save it as hello.sh.
Make it executable:
chmod +x hello.sh
Run it:
./hello.sh
Output:
Hello, world!
๐Ÿ‘‰ Without the #!/bin/bash line, Linux will use the shell of the session you are logged into.
3
2 comments
Michael Sanderson
3
Linux Tip of the Day (Beginner Bash Scripting): ๐Ÿ’ป๐Ÿ—’๏ธ
Linux Infrastructure Academy
skool.com/linuxinfrastructureacademy
Master Linux infrastructure and DevOps skills with hands-on labs, tools, and community support. Build smarter, faster, and more secure systems.
Leaderboard (30-day)
Powered by