🚀 Learn 90+ coding courses & crack 200+ competitive exams — powered by learning intelligence on Leyaa.ai →
write a shell script to print hello world
Let's write a shell script to print hello world.
Hello World Script
hello.sh
Example
#Hello World Shell Scriptecho "Hello World"
Output
sh hello.sh
Hello World
write a shell script to take 2 arguments to print hello world
We are going to pass "Hello" and "World" as an argument to the shell script Instead of printing it directly.
Hello World Script
hello.sh
Example
#Hello World Shell Scriptecho $1 $2
Output
sh hello.sh Hello World
Hello World
Command Line Arguments - While running the script, we need to pass the arguments after sh filename.sh.
$1 holds the argument 1 ("Hello").
$2 holds the argument 2 ("World").
🚀 One platform. 90+ coding courses. 200+ exams.
From programming fundamentals to competitive exam prep — learn with intelligence, not just content. Free on Leyaa.
Explore Leyaa.ai Free →