Let’s find how to prompt and read input variables from keyboard while executing a script using shell, perl, python, batch and powershell (windows and Linux)
On Linux via shell
read -p “Enter your name: ” name
echo “Hi, $name. Let’s be friend!”
On Windows via powershell
$name=read-host “Enter your name:”
write-host “Hi $name, Let’s be friend!”On Windows via batch
Set /p Name=”Enter your name:”
echo “Hi %name%, Let’s be friend!”On Windows or Linux via perl
print “Enter your name “;
my $name =;
chomp $name; # Get rid of newline character at the end
print “Hello $name, let’s be friend”;On Windows or Linux via python
name=input(“Enter your name: “)
print (“Hello ” + name + ” let’s be friend”)