Your First Script
In this page:
Your First Script
A complete first script combines the shebang, a few commands, and comments explaining intent. Saving it with a .sh extension is a convention, not a requirement — Bash doesn't care about file extensions. What matters is the shebang line and execute permission.
Note: Keep your first scripts small and test them often rather than writing many commands before running anything.
Example: Your First Script
#!/bin/bash
# My first Bash script
echo "Starting script..."
name="World"
echo "Hello, $name!"
echo "Script finished."
Login to try C/C++/Java/PHP code in the editor
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: