How to read input from command line from shell script

 How to read input from command line  from shell script


to read dynamically the input argument from command prompt or ssh . in this tutorial we will create a new file

example3.sh



#!/bin/sh
echo "What is your fouravitue number"
read NUMBER
echo "Your luck number is  $NUMBER"




after saving the above file , try to execute in the command line


sh example3.sh

it will ask for input , please enter your desired number,

The same number will be printed on the screen


Comments

Popular posts from this blog

Vendor autoload is not found. Please run 'composer install' under application root directory.

Uncaught TypeError: require.config is not a function CSS and Javascript files are not loading after Magento 2 installation

HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0