Linux Bash Shell Program - Hello World
Hello World in a Linux Shell Program
The "Hello, World!" program is a simple program that outputs the string "Hello, World!" to the screen. In the Linux shell, you can create this program using a text editor such as vi or nano and then running the program by calling it from the command line.
Here is an example of a "Hello, World!" program in the Bash shell:
#!/bin/bash
echo "Hello World!"
#!/bin/bash
The first line, #!/bin/bash, is called a shebang and it is used to specify the interpreter for running the script.
echo "Hello, World!"
The second line, echo "Hello, World!", is used to print the string "Hello, World!" to the screen.
Make the Program Executable
You can save this program in a file called "hello.sh" and make it executable by running the command:
chmod +x hello.sh
Run the Program
Then you can run the program by typing:
./hello.sh
Image by 200 Degrees from Pixabay
Comments
Post a Comment