How to write basic script
#!/bin/bash
echo "This is my first script"
On Linux, a shebang (#!) is a special line at the beginning of a script that tells the operating system which interpreter to use when executing the script. “/bin/bash” is tell the path of interpreter we are using.
“echo” is a Unix/Linux command tool used for displaying lines of text or string.
let take input from user
#!/bin/bash
echo "lets take input from user"
read userinput
echo "User Input : $userinput"
The read command is a way for the users to interact with input taken from the keyboard.
In shell scripting, the dollar sign ($) is used to reference the value of a variable.
In this script, the dollar sign is used to reference the value of the userinput
variable. if user enter “Hello, World!” as input then When the script is executed, it will shows output:
output :
uses of $ sign :
Thank you for reading!
Top comments (0)